DeclarationUpgradeForm.php 22 KB

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