MDeliverySetting.Class.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <?php
  2. /**
  3. * 配送方式设置
  4. * Created by PhpStorm.
  5. * User: XiaoMing
  6. * Date: 2019/10/31
  7. * Time: 15:53
  8. */
  9. namespace JinDouYun\Model\System;
  10. use JinDouYun\Controller\Common\Logger;
  11. use JinDouYun\Dao\System\DDeliveryRule;
  12. use JinDouYun\Dao\System\DDeliverySelfRule;
  13. use JinDouYun\Dao\System\DExpressCode;
  14. use Mall\Framework\Core\StatusCode;
  15. use Mall\Framework\Core\ErrorCode;
  16. use Mall\Framework\Core\ResultWrapper;
  17. use JinDouYun\Dao\System\DDeliverySetting;
  18. use JinDouYun\Dao\System\DAdminSetting;
  19. class MDeliverySetting
  20. {
  21. private $objDDeliverySetting;
  22. private $objDAdminSetting;
  23. private $onlineUserId;
  24. private $onlineEnterpriseId;
  25. /**
  26. * @var DDeliveryRule
  27. */
  28. private $objDDeliveryRule;
  29. /**
  30. * @var DDeliverySelfRule
  31. */
  32. private $objDDeliverySelfRule;
  33. /**
  34. * MDeliverySetting constructor.
  35. * @param $onlineUserId
  36. * @param $onlineEnterpriseId
  37. */
  38. public function __construct($onlineUserId, $onlineEnterpriseId)
  39. {
  40. $this->onlineUserId = $onlineUserId;
  41. $this->onlineEnterpriseId = $onlineEnterpriseId;
  42. $this->objDDeliverySetting = new DDeliverySetting('default');
  43. $this->objDAdminSetting = new DAdminSetting('default');
  44. $this->objDDeliveryRule = new DDeliveryRule();
  45. $this->objDDeliveryRule->setTable('qianniao_delivery_rule_' . $this->onlineEnterpriseId);
  46. $this->objDDeliverySelfRule = new DDeliverySelfRule();
  47. $this->objDDeliverySelfRule->setTable('qianniao_delivery_self_rule_' . $this->onlineEnterpriseId);
  48. self::initDelivery();
  49. }
  50. /**
  51. * Doc: (des="初始化配送方式")
  52. * User: XMing
  53. * Date: 2020/9/7
  54. * Time: 10:33 上午
  55. */
  56. private function init($shopId = 0)
  57. {
  58. $adminLists = $this->objDAdminSetting->select(['type' => StatusCode::$adminSettingType['delivery']]);
  59. if ($adminLists === false) {
  60. return ResultWrapper::fail($this->objDAdminSetting->error(), ErrorCode::$dberror);
  61. }
  62. if (empty($adminLists)) {
  63. return ResultWrapper::success(true);
  64. }
  65. $allSignIds = [];
  66. foreach ($adminLists as $value) {
  67. $allSignIds[] = $value['signId'];
  68. }
  69. $deliveryLists = $this->objDDeliverySetting->select(['shopId' => $shopId, 'enterpriseId' => $this->onlineEnterpriseId, 'deliveryType' => $allSignIds]);
  70. if ($deliveryLists === false) {
  71. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  72. }
  73. $insert = [];
  74. if (empty($deliveryLists)) {
  75. foreach ($adminLists as $item) {
  76. $insert[] = [
  77. 'enterpriseId' => $this->onlineEnterpriseId,
  78. 'settingId' => $item['id'],
  79. 'defaultStatus' => $item['signId'] == StatusCode::$deliveryType['selfMention'] ? StatusCode::$standard : StatusCode::$delete,
  80. 'enableStatus' => StatusCode::$standard,
  81. 'createTime' => time(),
  82. 'deliveryType' => $item['signId'],
  83. 'title' => $item['title'],
  84. 'shopId' => $shopId
  85. ];
  86. }
  87. } else {
  88. $deliverySignIds = [];
  89. foreach ($deliveryLists as $value) {
  90. $deliverySignIds[] = $value['deliveryType'];
  91. }
  92. foreach ($adminLists as $item) {
  93. if (!in_array($item['signId'], $deliverySignIds)) {
  94. $insert[] = [
  95. 'enterpriseId' => $this->onlineEnterpriseId,
  96. 'settingId' => $item['id'],
  97. 'defaultStatus' => StatusCode::$delete,
  98. 'enableStatus' => StatusCode::$standard,
  99. 'createTime' => time(),
  100. 'deliveryType' => $item['signId'],
  101. 'title' => $item['title'],
  102. 'shopId' => $shopId
  103. ];
  104. }
  105. }
  106. }
  107. if (!empty($insert)) {
  108. $insertResult = $this->objDDeliverySetting->insert($insert, true);
  109. if ($insertResult === false) {
  110. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  111. }
  112. }
  113. return ResultWrapper::success(true);
  114. }
  115. /**
  116. * Doc: (des="配置配送方式")
  117. * User: XMing
  118. * Date: 2020/9/7
  119. * Time: 10:40 上午
  120. * @param $params
  121. * @param int $id
  122. * @return ResultWrapper
  123. */
  124. public function setData($params)
  125. {
  126. $shopId = $params['shopId'];
  127. unset($params['shopId']);
  128. if (isset($params['id']) && !empty($params['id'])) {
  129. $id = $params['id'];
  130. unset($params['id']);
  131. $result = $this->objDDeliveryRule->update(['shopId' => $shopId, 'setData' => json_encode($params), 'updateTime' => time()], ['id' => $id]);
  132. } else {
  133. $result = $this->objDDeliveryRule->insert(['shopId' => $shopId, 'setData' => json_encode($params), 'createTime' => time()]);
  134. }
  135. if ($result === false) {
  136. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  137. }
  138. return ResultWrapper::success(true);
  139. }
  140. /**
  141. * Doc: (des="设置自提点")
  142. * User: XMing
  143. * Date: 2020/9/9
  144. * Time: 10:33 上午
  145. * @param $params
  146. * @return ResultWrapper
  147. */
  148. public function setSelfData($params)
  149. {
  150. $shopId = $params['shopId'];
  151. unset($params['shopId']);
  152. if (isset($params['id']) && !empty($params['id'])) {
  153. $id = $params['id'];
  154. unset($params['id']);
  155. $result = $this->objDDeliverySelfRule->update(['setData' => json_encode($params), 'shopId' => $shopId, 'updateTime' => time()], ['id' => $id]);
  156. } else {
  157. $result = $this->objDDeliverySelfRule->insert(['setData' => json_encode($params), 'shopId' => $shopId, 'createTime' => time()]);
  158. }
  159. if ($result === false) {
  160. return ResultWrapper::fail($this->objDDeliverySelfRule->error(), ErrorCode::$dberror);
  161. }
  162. return ResultWrapper::success(true);
  163. }
  164. /**
  165. * Doc: (des="删除运费模版规则")
  166. * User: XMing
  167. * Date: 2020/9/7
  168. * Time: 4:57 下午
  169. * @param int $id
  170. * @return ResultWrapper
  171. */
  172. public function delDeliveryRule(int $id)
  173. {
  174. $result = $this->objDDeliveryRule->update(['deleteStatus' => StatusCode::$delete, 'updateTime' => time()], ['id' => $id]);
  175. if ($result === false) {
  176. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  177. }
  178. return ResultWrapper::success(true);
  179. }
  180. /**
  181. * Doc: (des="删除自提点")
  182. * User: XMing
  183. * Date: 2020/9/9
  184. * Time: 10:56 上午
  185. * @param int $id
  186. * @return ResultWrapper
  187. */
  188. public function delDeliverySelfRule(int $id)
  189. {
  190. $result = $this->objDDeliverySelfRule->update(['deleteStatus' => StatusCode::$delete, 'updateTime' => time()], ['id' => $id]);
  191. if ($result === false) {
  192. return ResultWrapper::fail($this->objDDeliverySelfRule->error(), ErrorCode::$dberror);
  193. }
  194. return ResultWrapper::success(true);
  195. }
  196. /**
  197. * 配送方式列表
  198. * @param $selectParams
  199. * @return ResultWrapper
  200. */
  201. public function getAllDelivery($selectParams)
  202. {
  203. !empty($selectParams['shopId']) && self::init($selectParams['shopId']);
  204. $fields = 'd.id,d.defaultStatus,d.enableStatus,d.deliveryType,d.setData,a.title,a.signId';
  205. $sql = 'SELECT ' . $fields . ' FROM qianniao_delivery_setting as d
  206. LEFT JOIN qianniao_admin_setting as a
  207. ON a.signId = d.deliveryType WHERE d.deleteStatus = ' . StatusCode::$standard . '
  208. AND d.enterpriseId = ' . $this->onlineEnterpriseId . ' AND a.type = ' . StatusCode::$adminSettingType['delivery'];
  209. if (isset($selectParams['shopId']) && !empty($selectParams['shopId'])) {
  210. $sql .= ' AND d.shopId = ' . $selectParams['shopId'];
  211. } else {
  212. $sql .= ' AND d.shopId = 0 ';
  213. }
  214. $lists = $this->objDDeliverySetting->query($sql);
  215. if ($lists === false) {
  216. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  217. }
  218. if(empty($lists)){
  219. return ResultWrapper::success(['data'=>[],'total'=>0]);
  220. }
  221. foreach ($lists as $key => $value){
  222. $lists[$key]['setData'] = !empty($value['setData']) ? json_decode($value['setData'], true) : (object)[];
  223. }
  224. $returnData = [
  225. 'data' => $lists,
  226. 'total' => count((array)$lists),
  227. ];
  228. return ResultWrapper::success($returnData);
  229. }
  230. /**
  231. * @param $data
  232. * @return mixed
  233. */
  234. private function formatDelivery($data)
  235. {
  236. if (empty($data)) return $data;
  237. foreach ($data as $key => &$val) {
  238. if (!isset($val['deliveryType'])) {
  239. unset($data[$key]);
  240. continue;
  241. }
  242. if (isset($val['deliveryType'])) {
  243. $val['id'] = $val['deliveryType'];
  244. }
  245. $data[$key]['setData'] = json_decode($val['setData'], true);
  246. }
  247. return $data;
  248. }
  249. /**
  250. * 配送方式,启用/禁用
  251. * @param $params
  252. * @return ResultWrapper
  253. */
  254. public function updateEnableStatus($params)
  255. {
  256. // 判断自提点是否为空,为空则不设置;
  257. $ifExtraction = self::getInfo($params['id'],0);
  258. if(empty($ifExtraction)){
  259. return ResultWrapper::success('当前自提点未设置,不能勾选');
  260. }
  261. $finallyResult = $this->objDDeliverySetting->update(['enableStatus' => $params['enableStatus'], 'updateTime' => time()], ['id' => $params['id'], 'enterpriseId' => $this->onlineEnterpriseId]);
  262. if ($finallyResult === false) {
  263. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  264. }
  265. return ResultWrapper::success(true);
  266. }
  267. /**
  268. * 更新配送方式的默认状态
  269. * @param $params
  270. * @return ResultWrapper
  271. */
  272. public function updateDefaultStatus($params)
  273. {
  274. if ($params['defaultStatus'] == StatusCode::$standard) {
  275. $updateResult = $this->objDDeliverySetting->update(['defaultStatus' => StatusCode::$delete], ['enterpriseId' => $this->onlineEnterpriseId, 'shopId' => $params['shopId']]);
  276. if ($updateResult === false) {
  277. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  278. }
  279. }
  280. $finallyResult = $this->objDDeliverySetting->update(['defaultStatus' => $params['defaultStatus'], 'updateTime' => time()], ['id' => $params['id'], 'enterpriseId' => $this->onlineEnterpriseId]);
  281. if ($finallyResult === false) {
  282. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  283. }
  284. return ResultWrapper::success($finallyResult);
  285. }
  286. /**
  287. * 用于获取配送方式(设置->配送方式列表不要使用此接口)
  288. * @param int $shopId
  289. * @return array|ResultWrapper
  290. */
  291. public function allDelivery($shopId = 0)
  292. {
  293. $sql = 'SELECT a.title,d.deliveryType,d.defaultStatus,d.setData FROM qianniao_delivery_setting as d LEFT JOIN qianniao_admin_setting AS a ON d.settingId=a.id WHERE d.enterpriseId=' . $this->onlineEnterpriseId . ' AND deleteStatus=' . StatusCode::$standard . ' AND a.type=' . StatusCode::$adminSettingType['delivery'] . ' AND enableStatus=' . StatusCode::$standard;
  294. if (empty($shopId)) {
  295. $sql .= ' AND d.shopId = 0';
  296. } else {
  297. $sql .= ' AND d.shopId = ' . (int)$shopId;
  298. }
  299. $dbResult = $this->objDDeliverySetting->query($sql);
  300. if ($dbResult === false) {
  301. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  302. }
  303. if( empty($dbResult) ){
  304. return ResultWrapper::success(['data'=>[]]);
  305. }
  306. $returnData = [
  307. 'data' => self::formatDelivery($dbResult)
  308. ];
  309. return ResultWrapper::success($returnData);
  310. }
  311. /**
  312. * Doc: (des="")
  313. * User: XMing
  314. * Date: 2020/9/7
  315. * Time: 12:30 下午
  316. * @param int $id
  317. * @param int $shopId
  318. * @return ResultWrapper
  319. */
  320. public function getInfo(int $id, $shopId = 0): ResultWrapper
  321. {
  322. $info = $this->objDDeliverySetting->get(['id' => $id]);
  323. if ($info === false) {
  324. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  325. }
  326. if (empty($info)) {
  327. return ResultWrapper::success([]);
  328. }
  329. $ruleLists = [];
  330. if ($info['deliveryType'] == StatusCode::$deliveryType['goodsDelivery']) {
  331. $where = ['deleteStatus' => StatusCode::$standard];
  332. $where['shopId'] = $shopId;
  333. $ruleLists = $this->objDDeliveryRule->select($where);
  334. if ($ruleLists === false) {
  335. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  336. }
  337. } else {
  338. //平台可以管理所有自提点
  339. $where = ['deleteStatus' => StatusCode::$standard];
  340. if (!empty($shopId)) {
  341. $where['shopId'] = $shopId;
  342. }
  343. $ruleLists = $this->objDDeliverySelfRule->select($where);
  344. if ($ruleLists === false) {
  345. return ResultWrapper::fail($this->objDDeliverySelfRule->error(), ErrorCode::$dberror);
  346. }
  347. }
  348. $mapRule = [];
  349. foreach ($ruleLists as $key => $list) {
  350. $mapRule[$key] = empty($list['setData']) ? [] : json_decode($list['setData'], true);
  351. $mapRule[$key]['id'] = $list['id'];
  352. $mapRule[$key]['createTime'] = $list['createTime'];
  353. if ($info['deliveryType'] == StatusCode::$deliveryType['goodsDelivery']) {
  354. $mapRule[$key]['isDefault'] = $list['isDefault'];
  355. }
  356. }
  357. $info['setData'] = $mapRule;
  358. return ResultWrapper::success($info);
  359. }
  360. /**
  361. * Doc: (des="获取运费模版详情")
  362. * User: XMing
  363. * Date: 2020/9/8
  364. * Time: 6:26 下午
  365. * @param $id
  366. * @return ResultWrapper
  367. */
  368. public function getRuleInfo($id)
  369. {
  370. $ruleInfo = $this->objDDeliveryRule->get(['id' => $id]);
  371. if ($ruleInfo === false) {
  372. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  373. }
  374. if (empty($ruleInfo)) {
  375. return ResultWrapper::success([]);
  376. }
  377. $ruleInfo['setData'] = json_decode($ruleInfo['setData'], true);
  378. $ruleInfo['setData']['id'] = $id;
  379. return ResultWrapper::success($ruleInfo);
  380. }
  381. /**
  382. * Doc: (des="获取自提点详情")
  383. * User: XMing
  384. * Date: 2020/9/9
  385. * Time: 10:49 上午
  386. * @param $id
  387. * @return ResultWrapper
  388. */
  389. public function getSelfRuleInfo($id)
  390. {
  391. $ruleInfo = $this->objDDeliverySelfRule->get(['id' => $id]);
  392. if ($ruleInfo === false) {
  393. return ResultWrapper::fail($this->objDDeliverySelfRule->error(), ErrorCode::$dberror);
  394. }
  395. if (empty($ruleInfo)) {
  396. return ResultWrapper::success([]);
  397. }
  398. $ruleInfo['setData'] = json_decode($ruleInfo['setData'], true);
  399. $ruleInfo['setData']['id'] = $id;
  400. return ResultWrapper::success($ruleInfo);
  401. }
  402. /**
  403. * Doc: (des="")
  404. * User: XMing
  405. * Date: 2020/9/7
  406. * Time: 6:20 下午
  407. */
  408. public function getAllExpressRule()
  409. {
  410. $ruleLists = $this->objDDeliveryRule->select(['deleteStatus' => StatusCode::$standard], 'setData,id,isDefault');
  411. if ($ruleLists === false) {
  412. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  413. }
  414. $map = [];
  415. foreach ($ruleLists as $list) {
  416. $rule = empty($list['setData']) ? [] : json_decode($list['setData'], true);
  417. $map[] = [
  418. 'id' => $list['id'],
  419. 'title' => isset($rule['name']) ? $rule['name'] : '',
  420. 'isDefault' => $list['isDefault']
  421. ];
  422. }
  423. $ret = [
  424. 'total' => count($map),
  425. 'data' => $map
  426. ];
  427. return ResultWrapper::success($ret);
  428. }
  429. /**
  430. * Doc: (des="")
  431. * User: XMing
  432. * Date: 2020/9/9
  433. * Time: 12:09 下午
  434. */
  435. public function getAllSelfExpressRule($shopId = 0)
  436. {
  437. $where = [
  438. 'deleteStatus' => StatusCode::$standard,
  439. 'enableStatus' => StatusCode::$standard
  440. ];
  441. if (!empty($shopId)){
  442. $where['shopId'] = $shopId;
  443. }
  444. $ruleLists = $this->objDDeliverySelfRule->select($where);
  445. if ($ruleLists === false) {
  446. return ResultWrapper::fail($this->objDDeliverySelfRule->error(), ErrorCode::$dberror);
  447. }
  448. if (empty($ruleLists)) {
  449. return ResultWrapper::success([]);
  450. }
  451. foreach ($ruleLists as &$list) {
  452. $list['setData'] = empty($list['setData']) ? [] : json_decode($list['setData'], true);
  453. }
  454. return ResultWrapper::success($ruleLists);
  455. }
  456. /**
  457. * Doc: (des="初始化配送方式")
  458. * User: XMing
  459. * Date: 2020/7/13
  460. * Time: 6:08 下午
  461. */
  462. public function initDelivery()
  463. {
  464. $settingAll = $this->objDAdminSetting->select(['type' => StatusCode::$adminSettingType['delivery']]);
  465. if ($settingAll === false) {
  466. Logger::logs(E_USER_ERROR, 'sql错误', __CLASS__, __LINE__, $this->objDAdminSetting->error());
  467. return false;
  468. }
  469. if (empty($settingAll)) {
  470. return true;
  471. }
  472. $Delivery = $this->objDDeliverySetting->select(['enterpriseId' => $this->onlineEnterpriseId], 'settingId');
  473. if ($Delivery === false) {
  474. Logger::logs(E_USER_ERROR, 'sql错误', __CLASS__, __LINE__, $this->objDAdminSetting->error());
  475. return false;
  476. }
  477. $insert = [];
  478. $allSettingIds = empty($Delivery) ? [] : array_column($Delivery, 'settingId');
  479. foreach ($settingAll as $key => $value) {
  480. if (!in_array($value['id'], $allSettingIds)) {
  481. $insert [$key] = [
  482. 'enterpriseId' => $this->onlineEnterpriseId,
  483. 'deliveryType' => $value['signId'],
  484. 'settingId' => $value['id'],
  485. 'defaultStatus' => StatusCode::$delete
  486. ];
  487. if ($value['signId'] == StatusCode::$deliveryType['logistics']) {
  488. //代码更新后没有物流这个配送方式
  489. $insert[$key]['deleteStatus'] = StatusCode::$delete;
  490. }
  491. if ($value['signId'] == StatusCode::$deliveryType['selfMention']) {
  492. $insert[$key]['defaultStatus'] = StatusCode::$standard;
  493. }
  494. }
  495. }
  496. $insert = array_values($insert);
  497. if (!empty($insert)) {
  498. $result = $this->objDDeliverySetting->insert($insert, true);
  499. if ($result === false) {
  500. Logger::logs(E_USER_ERROR, 'sql错误', __CLASS__, __LINE__, $this->objDDeliverySetting->error());
  501. return false;
  502. }
  503. return true;
  504. }
  505. }
  506. /**
  507. * Doc: (des="设置默认规则")
  508. * User: XMing
  509. * Date: 2020/9/10
  510. * Time: 2:09 下午
  511. * @param int $id
  512. * @return ResultWrapper
  513. */
  514. public function setDefaultRule(int $id, $shopId)
  515. {
  516. $updateResult = $this->objDDeliveryRule->update(['isDefault' => StatusCode::$delete], ['deleteStatus' => StatusCode::$standard, 'shopId' => $shopId]);
  517. $this->objDDeliveryRule->beginTransaction();
  518. if ($updateResult === false) {
  519. $this->objDDeliveryRule->rollBack();
  520. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  521. }
  522. unset($updateResult);
  523. $updateResult = $this->objDDeliveryRule->update(['isDefault' => StatusCode::$standard], ['id' => $id]);
  524. if ($updateResult === false) {
  525. $this->objDDeliveryRule->rollBack();
  526. return ResultWrapper::fail($this->objDDeliveryRule->error(), ErrorCode::$dberror);
  527. }
  528. $this->objDDeliveryRule->commit();
  529. return ResultWrapper::success(true);
  530. }
  531. /**
  532. * Doc: (des="")
  533. * User: XMing
  534. * Date: 2020/9/8
  535. * Time: 6:54 下午
  536. */
  537. public function getAllExpress()
  538. {
  539. $objDExpressCode = new DExpressCode();
  540. $expressLists = $objDExpressCode->select([], '*', 'id DESC');
  541. if ($expressLists === false) {
  542. return ResultWrapper::fail($objDExpressCode->error(), ErrorCode::$dberror);
  543. }
  544. return ResultWrapper::success([
  545. 'total' => count($expressLists),
  546. 'data' => $expressLists
  547. ]);
  548. }
  549. /**
  550. * 物流提醒
  551. * @param $reminderData
  552. * @return ResultWrapper
  553. */
  554. public function updateLogisticsReminder($reminderData)
  555. {
  556. $reminderDataId = $reminderData['id'];
  557. unset($reminderData['id']);
  558. $dbResult = $this->objDDeliverySetting->update(['setData'=>json_encode($reminderData)],['id'=>$reminderDataId]);
  559. if($dbResult === false){
  560. return ResultWrapper::fail($this->objDDeliverySetting->error(), ErrorCode::$dberror);
  561. }else{
  562. return ResultWrapper::success($dbResult);
  563. }
  564. }
  565. }