DeclarationUpgradeForm.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <?php
  2. namespace common\models\forms;
  3. use common\components\Model;
  4. use common\helpers\Cache;
  5. use common\helpers\Date;
  6. use common\helpers\Form;
  7. use common\helpers\user\Cash;
  8. use common\helpers\user\Info;
  9. use common\models\Config;
  10. use common\models\DeclarationLevel;
  11. use common\models\DeclarationPackage;
  12. use common\models\DecLevelLog;
  13. use common\models\DecOrder;
  14. use common\models\EmployLevel;
  15. use common\models\Order;
  16. use common\models\OrderGoods;
  17. use common\models\Period;
  18. use common\models\ReceiveAddress;
  19. use common\models\Region;
  20. use common\models\ShopGoods;
  21. use common\models\User;
  22. use common\models\UserInfo;
  23. use common\models\UserNetwork;
  24. use Yii;
  25. use yii\base\Exception;
  26. /**
  27. * 升级管理,进行升级
  28. */
  29. class DeclarationUpgradeForm extends Model
  30. {
  31. public $type;
  32. public $decLv;
  33. public $decWay;
  34. public $packageId;
  35. public $goodsId;
  36. public $goodsNum;
  37. public $insertUserName;
  38. public $consignee;
  39. public $acceptMobile;
  40. public $province;
  41. public $city;
  42. public $county;
  43. public $lgaName;
  44. public $cityName;
  45. public $address;
  46. public $nowPerf;
  47. public $nextPerf;
  48. public $decUserName;
  49. public $remark;
  50. // 传过来的全部数据
  51. public $allData;
  52. private $_decId;
  53. public $_insertUserId;
  54. private $_decAmount;
  55. private $_decPv;
  56. private $_orderGoods;
  57. private $_standardAmount;
  58. private $_decAmountStandard;
  59. const TYPE_ZC = 'ZC';
  60. private $_userForm = null;
  61. // 全部的安置网上级
  62. private $_tempNetworkParentUser = [];
  63. /**
  64. * @inheritdoc
  65. */
  66. public function rules()
  67. {
  68. return [
  69. [['remark','type','decLv','decWay','packageId','goodsId', 'goodsNum', 'insertUserName','consignee','acceptMobile','province',/*'city','county',*/'lgaName','cityName','address','nowPerf','nextPerf'], 'trim'],
  70. [['type','decLv','decWay','insertUserName','nowPerf','province',/*'city','county',*/'address','acceptMobile'], 'required'],
  71. [['decUserName'], 'issetDec'], // 必须是报单中心
  72. [['decWay'], 'hasProduct'],// 必须选择商品
  73. [['decLv'], 'alreadyMaxDec'], //判断要升级用户是否已经是最高级
  74. ];
  75. }
  76. public function attributeLabels()
  77. {
  78. return [
  79. 'type' => 'Upgrade type',//升级类型
  80. 'decLv' => 'Upgrade level',//升级级别
  81. 'decWay' => 'Declaration method',//报单方式
  82. 'packageId' => 'Upgrade package',//升级套餐
  83. 'goodsId' => 'Product ID',//商品ID
  84. 'goodsNum' => 'Product quantity',//商品数量
  85. 'insertUserName' => 'Member number to be upgraded',//要升级的会员编号
  86. 'consignee' => 'consignee',//收货人
  87. 'acceptMobile' => 'The Phone Number of Consignee',//收货人手机
  88. 'province' => 'Receiving Province',//收货省
  89. 'city' => 'Receiving City',//收货市
  90. 'county' => 'Receiving area / county',//收货区县
  91. 'lgaName' => 'Local Government Area',
  92. 'cityName' => 'City',
  93. 'address' => 'Receiving detailed address',//收货详细地址
  94. ];
  95. }
  96. /**
  97. * 添加报单
  98. * @param $allData
  99. * @return bool|null
  100. * @throws Exception
  101. * @throws \yii\db\Exception
  102. */
  103. public function add($allData){
  104. if(!$this->validate()){
  105. return null;
  106. }
  107. $loginUserId = \Yii::$app->user->id;
  108. // 首购单
  109. if($this->type == self::TYPE_ZC){
  110. //报单商品及PV判断
  111. $decLevelConfig = Cache::getDecLevelConfig();
  112. $decLevel = $decLevelConfig[$this->decLv];
  113. $toDecLevel = $this->decLv;
  114. if(!$this->decLv){
  115. throw new Exception(Yii::t('app', 'pleaseSelectUpgradeLevel'));
  116. }
  117. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  118. $userId = $baseInfo['ID'];
  119. $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
  120. if ($userDecPvSum != $this->nowPerf) {
  121. throw new Exception(Yii::t('app', 'checkPerformanceOfUpgradedMember'));
  122. }
  123. // 获取用户是否是观察期
  124. $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
  125. $observeLimit = $observe['observePeriodLimit']['value']; // 月份限制
  126. $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
  127. $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
  128. if ($this->decWay != 2) {
  129. throw new Exception(Yii::t('app', 'upgradeMethodIncorrect'));
  130. }
  131. if($this->decWay==1) {
  132. // 先不加套餐升级方式
  133. // $decPackage = DeclarationPackage::findOneAsArray('ID=:ID', [':ID'=>$this->packageId]);
  134. // $this->_decAmount = $decPackage['AMOUNT'];
  135. // $this->_decPv = $decPackage['PV'];
  136. // $this->_orderGoods[] = [
  137. // 'GOODS_ID' => $this->packageId,
  138. // 'PRICE' => $this->_decAmount,
  139. // 'REAL_PRICE' => $this->_decAmount,
  140. // 'PV' => $this->_decPv,
  141. // 'REAL_PV' => $this->_decPv,
  142. // 'BUY_NUMS' => 1,
  143. // 'SKU_CODE' => $decPackage['PACKAGE_NO'],
  144. // 'GOODS_TITLE' => $decPackage['PACKAGE_NAME']
  145. // ];
  146. } else {
  147. $ids = $this->goodsId;
  148. $totalAmount = 0;
  149. $totalAmountStandard = 0;
  150. $totalPv = 0;
  151. $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0); // 汇率
  152. foreach ($this->goodsNum as $k => $v) {
  153. if ($v) {
  154. $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
  155. if (!$goods) {
  156. throw new Exception('Products does not exists!');
  157. }
  158. if($goods['STORE_NUMS']>0){
  159. $totalAmount += $goods['SELL_PRICE'] * intval($v);
  160. $totalAmountStandard += $goods['SELL_PRICE_STANDARD'] * intval($v);
  161. $realPriceStandard = $goods['SELL_PRICE_STANDARD'];
  162. $totalPv += $goods['PRICE_PV'] * intval($v);
  163. $this->_orderGoods[] = [
  164. 'GOODS_ID' => $goods['ID'],
  165. 'PRICE' => $goods['SELL_PRICE'],
  166. 'REAL_PRICE' => $goods['SELL_PRICE'],
  167. 'PV' => $goods['PRICE_PV'],
  168. 'REAL_PV' => $goods['PRICE_PV'],
  169. 'POINT' => $goods['POINT'],
  170. 'BUY_NUMS' => intval($v),
  171. 'SKU_CODE' => $goods['GOODS_NO'],
  172. 'GOODS_TITLE' => $goods['GOODS_NAME'],
  173. 'EMAIL' => Info::getUserEmailByUserId(\Yii::$app->user->id) ?? '',
  174. 'STANDARD_PRICE' => $goods['SELL_PRICE_STANDARD'],
  175. 'REAL_STANDARD_PRICE' => $realPriceStandard,
  176. 'EXCHANGE_RATE' => $exchangeRate,
  177. 'TAX_RATE' => $goods['TAX_RATE'],
  178. ];
  179. }
  180. }
  181. }
  182. // 这里特殊是用户原报单PV之和+用户购买的商品总PV
  183. $checkPv = $totalPv + $diffPerf;
  184. if($checkPv < $decLevel['PERF']) {
  185. throw new Exception(Yii::t('app', 'totalPVLessThan'), 400);
  186. }
  187. foreach ($decLevelConfig as $key=>$val){
  188. if($checkPv>=$val['PERF']){
  189. $toDecLevel = $key;
  190. }
  191. }
  192. if($this->decLv!=$toDecLevel){
  193. throw new Exception(Yii::t('app', 'totalPvExceedPv'), 400);
  194. }
  195. $this->_decAmount = $totalAmount;
  196. $this->_decPv = $totalPv;
  197. $this->_decAmountStandard = $totalAmountStandard;
  198. $this->_standardAmount = $this->_decAmountStandard;
  199. }
  200. //看现金余额是否充足
  201. if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
  202. throw new Exception(Yii::t('app', 'applicantCashShort'), 400);
  203. }
  204. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  205. $this->_insertUserId = $baseInfo['ID']; // 被报单人,通过insername 查找用户id
  206. $insertConId = $baseInfo['CON_UID'];
  207. $insertRecId = $baseInfo['REC_UID'];
  208. if(!($decResult = $this->addDecOrder($insertConId,$insertRecId, $baseInfo['DEC_LV'],$isObserve,$this->remark))) {
  209. throw new Exception(Yii::t('app', 'failed'), 400);
  210. }
  211. }
  212. return true;
  213. }
  214. /**
  215. * 添加报单订单
  216. * @return bool|UserInfo|null
  217. * @throws \yii\db\Exception
  218. */
  219. public function addDecOrder($insertConId,$insertRecId,$oriDecLv,$isObserve,$remark=''){
  220. $warehouse = Region::getWarehouseByCode($this->province);//仓库
  221. if(!$warehouse){
  222. throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'), 400);
  223. }
  224. $upgradeType = $isObserve ? 1 : 2; // 1补差 2全额
  225. $periodObj = Period::instance();
  226. $nowPeriodNum = $periodObj->getNowPeriodNum();
  227. $nowCalcMonth = $periodObj->getYearMonth($nowPeriodNum);
  228. $ord = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 10);
  229. // 加入报单信息
  230. $db = \Yii::$app->db;
  231. $transaction = $db->beginTransaction();
  232. try {
  233. $decOrderModel = new DecOrder();
  234. $decOrderModel->DEC_SN = 'DS'.$ord;
  235. $decOrderModel->ORDER_SN = 'OS'.$ord;
  236. $decOrderModel->TYPE = $this->type;
  237. $decOrderModel->USER_ID = \Yii::$app->user->id; // 报单人
  238. $decOrderModel->TO_USER_ID = $this->_insertUserId; // 被报单人
  239. $decOrderModel->DEC_AMOUNT = $this->_decAmount;
  240. $decOrderModel->DEC_PV = $this->_decPv;
  241. $decOrderModel->PERIOD_NUM = $nowPeriodNum;
  242. $decOrderModel->CALC_MONTH = $nowCalcMonth;
  243. $decOrderModel->P_CALC_MONTH = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  244. $decOrderModel->PAID_WALLET = 'cash';
  245. $decOrderModel->CON_USER_ID = $insertConId;
  246. $decOrderModel->REC_USER_ID = $insertRecId;
  247. $decOrderModel->DEC_ID = $this->_decId;
  248. $decOrderModel->IS_DEL = 0;
  249. $decOrderModel->DETAIL_TYPE = 2;
  250. $decOrderModel->CREATED_AT = Date::nowTime();
  251. $decOrderModel->UPGRADE_TYPE = $upgradeType;
  252. $decOrderModel->REMARK = $remark;
  253. $decOrderModel->ORI_LV = $oriDecLv; // 变更前的级别
  254. $decOrderModel->UPGRADE_LV = $this->decLv; // 变更后的级别
  255. if(!$decOrderModel->save()){
  256. $transaction->rollBack();
  257. throw new Exception(Form::formatErrorsForApi($decOrderModel->getErrors()));
  258. }
  259. $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0);
  260. $orderModel = new Order();
  261. $orderModel->SN = 'OS'.$ord;
  262. $orderModel->DEC_SN = 'DS'.$ord;
  263. $orderModel->ORDER_TYPE = $this->type;
  264. $orderModel->USER_ID = $this->_insertUserId;
  265. $orderModel->USER_NAME = $this->insertUserName; // 要升级的用户
  266. $orderModel->ORDER_AMOUNT = $this->_decAmount;
  267. $orderModel->PV = $this->_decPv;
  268. $orderModel->PAY_AMOUNT = $this->_decAmount;
  269. $orderModel->PAY_PV = $this->_decPv;
  270. $orderModel->PAY_AT = Date::nowTime();
  271. $orderModel->PAY_TYPE = 'cash';
  272. $orderModel->PERIOD_NUM = $nowPeriodNum;
  273. $orderModel->P_CALC_MONTH = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  274. $orderModel->FREIGHT = 0;
  275. $orderModel->PAY_FREIGHT = 0;
  276. $orderModel->CONSIGNEE = $this->consignee;
  277. $orderModel->MOBILE = $this->acceptMobile;
  278. $orderModel->PROVINCE = $this->province;
  279. // $orderModel->CITY = $this->city;
  280. // $orderModel->COUNTY = intval($this->county) ?? 0;
  281. $orderModel->LGA_NAME = $this->lgaName;
  282. $orderModel->CITY_NAME = $this->cityName;
  283. $orderModel->ADDRESS = $this->address;
  284. $orderModel->WAREHOUSE = $warehouse;
  285. $orderModel->STATUS = 1;
  286. $orderModel->CREATED_AT = Date::nowTime();
  287. $orderModel->CREATE_USER = Info::getUserNameByUserId(\Yii::$app->user->id);
  288. $orderModel->ORDER_AMOUNT_STANDARD = $this->_decAmountStandard;
  289. $orderModel->PAY_AMOUNT_STANDARD = $this->_standardAmount;
  290. $orderModel->EXCHANGE_RATE = $exchangeRate;
  291. if(!$orderModel->save()){
  292. $transaction->rollBack();
  293. throw new Exception(Form::formatErrorsForApi($orderModel->getErrors()));
  294. }
  295. /**
  296. * 2022-05-10
  297. * York
  298. */
  299. foreach ($this->goodsNum as $k => $v) {
  300. if ($v) {
  301. $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $this->goodsId[$k]]);
  302. $storenums = $goods['STORE_NUMS'] - $this->goodsNum[$k];
  303. if($goods['STATUS']==1){
  304. if($goods['STORE_NUMS'] >=$this->goodsNum[$k]){
  305. $data = ShopGoods::find()->where(['ID' => $this->goodsId[$k]])->one();
  306. $data->STORE_NUMS = $storenums;
  307. $data->update();
  308. if ($storenums==0){
  309. $data->STATUS = 0;
  310. $data->UPDATED_AT = Date::nowTime();
  311. $data->update();
  312. }
  313. }else{
  314. // throw new Exception("商品".$goods['GOODS_NAME']."库存不足");
  315. throw new Exception("product".$goods['GOODS_NAME']."Insufficient inventory");
  316. }
  317. }else{
  318. // throw new Exception("商品".$goods['GOODS_NAME']."已下架");
  319. throw new Exception("product".$goods['GOODS_NAME']."Removed from the shelf");
  320. }
  321. }
  322. }
  323. // 加入商品到订单商品表
  324. foreach($this->_orderGoods as $key=>$value){
  325. $this->_orderGoods[$key]['ORDER_SN'] = $orderModel->SN;
  326. $this->_orderGoods[$key]['P_CALC_MONTH'] = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  327. }
  328. OrderGoods::batchInsert($this->_orderGoods);
  329. //写入收货地址信息
  330. $addressModel = new ReceiveAddress();
  331. $addressModel->USER_ID = $this->_insertUserId;
  332. $addressModel->USER_NAME = $this->insertUserName;
  333. $addressModel->CONSIGNEE = $this->consignee;
  334. $addressModel->MOBILE = $this->acceptMobile;
  335. $addressModel->PROVINCE = $this->province;
  336. // $addressModel->CITY = $this->city;
  337. // $addressModel->COUNTY = intval($this->county) ?? 0;
  338. $addressModel->LGA_NAME = $this->lgaName;
  339. $addressModel->CITY_NAME = $this->cityName;
  340. $addressModel->ADDRESS = $this->address;
  341. $addressModel->IS_DEFAULT = 0;
  342. // print_r($addressModel);
  343. if(!$addressModel->save()){
  344. $transaction->rollBack();
  345. throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
  346. }
  347. // 扣报单人现金钱包
  348. // Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
  349. Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'by'.$this->insertUserName.'Upgrade entry']);
  350. // 为被升级人进行升级操作
  351. $decLevelLog = new DecLevelLog();
  352. $decLog = [
  353. 'userId' => $this->_insertUserId,//会员ID
  354. 'fromId' => $oriDecLv, // 变动前的级别
  355. 'levelId' => $this->decLv,// 变动后的级别
  356. 'actionId' => \Yii::$app->user->id,
  357. 'remark' => $this->remark,
  358. 'lvPv' => $this->_decPv
  359. ];
  360. $modifyDecLv = $decLevelLog->frontendChange($decLog);
  361. if (empty($modifyDecLv)) {
  362. $transaction->rollBack();
  363. throw new Exception(Yii::t('app', 'failedToUpgrade'), 400);
  364. }
  365. $transaction->commit();
  366. } catch(Exception $e) {
  367. $transaction->rollBack();
  368. throw new Exception($e->getMessage());
  369. return false;
  370. }
  371. return $modifyDecLv;
  372. }
  373. /**
  374. * 判断报单中心是否存在
  375. * @param $attribute
  376. */
  377. public function issetDec($attribute){
  378. $decUser = User::find()
  379. ->select('ID')
  380. ->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])
  381. ->asArray()
  382. ->one();
  383. if (!$decUser) {
  384. $this->addError($attribute, 'Stockist does not exist');//报单中心不存在
  385. return false;
  386. } else {
  387. // 判断报单中心是否在新加入会员的安置网上级中
  388. $this->loopFindParentToNetwork($this->insertUserName);
  389. //反转数组,in_array搜索错误
  390. //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
  391. $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
  392. if (!isset($flipParent[$this->decUserName])) {
  393. // $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
  394. $this->addError($attribute, 'by' . $this->insertUserName . 'Upgrade declaration, Stockist' . $this->decUserName . 'be not in' . $this->insertUserName . 'Online level of resettlement');
  395. return ;
  396. }
  397. $this->_decId = $decUser['ID'];
  398. }
  399. }
  400. // 判断是否已选择商品或套餐
  401. public function hasProduct($attribute) {
  402. if ($this->decWay==1 && empty($this->packageId)) {
  403. $this->addError($attribute, 'Purchase package upgrade, please select package');//购买套餐升级,请选择套餐
  404. return false;
  405. }
  406. if ($this->decWay!=1 && empty($this->goodsId)) {
  407. $this->addError($attribute, 'Purchase product upgrade, please select product');//购买商品升级,请选择商品'
  408. return false;
  409. }
  410. return true;
  411. }
  412. // 判断要升级的会员,是否已是最高级别
  413. public function alreadyMaxDec($attribute) {
  414. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  415. $userDecId = $baseInfo['DEC_LV'];// 用户当前的级别
  416. $maxPerfInfo = DeclarationLevel::getMaxDecPref();
  417. $maxDecId = $maxPerfInfo['ID']; // 级别配置中最高级别ID
  418. if ($maxDecId == $userDecId) {
  419. $this->addError($attribute, 'It is already the highest level and no upgrade is required');//已是最高级别,无需升级
  420. return false;
  421. }
  422. return true;
  423. }
  424. /**
  425. * 寻找被升级人的上级
  426. * @param null $conUserName
  427. * @return bool
  428. */
  429. private function loopFindParentToNetwork($conUserName = null) {
  430. if($conUserName == null ){
  431. $conUserName = $this->insertUserName;
  432. }
  433. $baseUser = Info::getBaseUserByUserName($conUserName);
  434. $userNetworkInfo = UserNetwork::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $baseUser['ID']]);
  435. unset($baseUser);
  436. $allParentUserIdsArr = explode(',', $userNetworkInfo['PARENT_UIDS']);
  437. unset($userNetworkInfo);
  438. $allParentUserIds = array_reverse($allParentUserIdsArr);
  439. unset($allParentUserIdsArr);
  440. if($allParentUserIds){
  441. foreach($allParentUserIds as $parentUserId) {
  442. $parentBaseUser = Info::getBaseUserById($parentUserId);
  443. if (is_null($parentBaseUser)) continue;
  444. $this->_tempNetworkParentUser[$this->insertUserName][] = $parentBaseUser['USER_NAME'] ;
  445. unset($parentUserId, $parentBaseUser);
  446. }
  447. }
  448. unset($allParentUserIds);
  449. return true;
  450. }
  451. // /**
  452. // * 删单
  453. // * @return bool
  454. // * @throws \yii\db\Exception
  455. // */
  456. // public function delete(){
  457. // if(!$this->validate()){
  458. // return false;
  459. // }
  460. // $transaction = \Yii::$app->db->beginTransaction();
  461. // try {
  462. // $oneOrder = $this->_oneOrder;
  463. // // 首购单要删除会员
  464. // if($this->type == self::TYPE_ZC){
  465. // UserInfo::deleteUser($oneOrder['TO_USER_ID']);
  466. // }
  467. // // 如果是复销单的话,还需要考虑给会员的复销池减去金额
  468. // elseif($this->type == self::TYPE_FX){
  469. // Reconsume::changePoolPV($oneOrder['TO_USER_ID'], -abs($oneOrder['DEC_PV']), ['REMARK'=>'删单扣除', 'DEAL_TYPE'=>Reconsume::TYPE_AUDIT_PV]);
  470. // }
  471. // $transaction->commit();
  472. // } catch (Exception $e) {
  473. // $transaction->rollBack();
  474. // $this->addError('delete', $e->getMessage());
  475. // return false;
  476. // }
  477. // return true;
  478. // }
  479. }