Manage.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <?php namespace Seller\Lib;
  2. use Dever;
  3. use Dever\Helper\Str;
  4. use Manage\Lib\Auth;
  5. class Manage extends Auth
  6. {
  7. # 获取商户列表
  8. public function getInfo()
  9. {
  10. return Dever::db('info', 'seller')->select(array('status' => 1));
  11. }
  12. # 获取卡密可以分配的商户列表
  13. public function getList($channel_id)
  14. {
  15. $data[0] = array
  16. (
  17. 'id' => -1,
  18. 'name' => '--通用卡密--',
  19. );
  20. $seller = array();
  21. if ($channel_id) {
  22. $seller_channel = Dever::db('channel', 'seller')->select(array('channel_id' => $channel_id, 'status' => 1));
  23. if ($seller_channel) {
  24. foreach ($seller_channel as $v) {
  25. $info = Dever::db('info', 'seller')->find(array('id' => $v['seller_id'], 'status' => 1));
  26. if ($info) {
  27. $seller[] = $info;
  28. }
  29. }
  30. }
  31. }
  32. $data = array_merge($data, $seller);
  33. return $data;
  34. }
  35. # 为商户生成appkey
  36. public function createAppKey($data)
  37. {
  38. $info = Dever::db('info', 'seller')->find($data['id']);
  39. if (!$info['appkey']) {
  40. $update['appkey'] = 'app' . Str::rand(15, 0);
  41. $update['appsecret'] = strtoupper(Str::rand(32));
  42. $check = Dever::db('info', 'seller')->find(array('appkey' => $update['appkey']));
  43. if ($check) {
  44. return $this->createAppKey($data);
  45. }
  46. Dever::db('info', 'seller')->update($data['id'], $update);
  47. }
  48. /*
  49. # 写到redis中
  50. $info = Dever::db('info', 'seller')->find($data['id']);
  51. Dever::cache('seller_' . $info['appkey'], $info);
  52. */
  53. }
  54. # 为商户生成账号
  55. public function createUser($data)
  56. {
  57. if (isset($data['mobile']) && $data['mobile'] && isset($data['password']) && $data['password']) {
  58. $info = Dever::db('info', 'seller')->find($data['id']);
  59. Dever::load('group', 'manage')->createUser('seller', $info['id'], $info['name'], $data['mobile'], $data['password'], true);
  60. }
  61. return $data;
  62. }
  63. # 订单手动充值
  64. public function createOrder($data)
  65. {
  66. if (!$data['seller_id']) {
  67. Dever::error('未选择商户');
  68. }
  69. if (!$data['data']) {
  70. Dever::error('未输入充值数据');
  71. }
  72. //$goods = explode(',', $data['goods']);
  73. $goods_id = $data['goods_id'];
  74. $sku_id = $data['sku_id'];
  75. $seller_id = $data['seller_id'];
  76. $seller = Dever::db('info', 'seller')->find($seller_id);
  77. if (!$seller) {
  78. Dever::error('商户不存在');
  79. }
  80. if ($seller && $seller['status'] == 2) {
  81. Dever::error('商户已封禁');
  82. }
  83. if (!$goods_id) {
  84. Dever::error('未选择商品');
  85. }
  86. if (!$sku_id) {
  87. Dever::error('未选择规格');
  88. }
  89. $goods = Dever::db('info', 'goods')->find($goods_id);
  90. $sku = Dever::db('info_sku', 'goods')->find($sku_id);
  91. if (!$goods) {
  92. Dever::error('商品不存在');
  93. }
  94. if (!$sku) {
  95. Dever::error('规格不存在');
  96. }
  97. if ($sku['info_id'] != $goods['id']) {
  98. Dever::error('商品['.$goods['name'].']下无此规格');
  99. }
  100. $cate = Dever::db('cate', 'goods')->find($goods['cate_id']);
  101. $class = Dever::load('order', 'seller');
  102. if ($cate['key'] == 'km') {
  103. $num = $data['data'];
  104. # 验证是否有剩余的卡密
  105. # 获取渠道
  106. $channel_num = 0;
  107. $channel = $class->channel($seller['id'], $goods['id'], $sku['id'], $channel_num);
  108. if (!$channel) {
  109. Dever::error('通道未开启');
  110. }
  111. if ($num > $channel['max']) {
  112. Dever::error('不能超过最大购买数:' . $channel['max'] . '张');
  113. }
  114. $total = Dever::db('card', 'channel')->count(array('channel_id' => $channel['id'], 'goods_id' => $goods['id'], 'sku_id' => $sku['id'], 'status' => 1, 'use_status' => 1));
  115. if ($total < $num) {
  116. Dever::error('剩余卡密数量不足,当前剩余卡密数量:' . $total . '张');
  117. }
  118. $order = Str::order('PAY');
  119. $class->add($seller, $goods, $sku, $cate['key'] . '_' . $seller['id'], $order, $num);
  120. } else {
  121. $param = explode("\r\n", $data['data']);
  122. foreach ($param as $k => $v) {
  123. $order = Str::order('PAY') . '_' . $k;
  124. $class->add($seller, $goods, $sku, $v, $order);
  125. }
  126. }
  127. return $data;
  128. }
  129. # 修改订单状态
  130. public function editOrder($id, $data)
  131. {
  132. if ($data['status'] < 10) {
  133. Dever::error('请选择订单状态');
  134. }
  135. $newid = array();
  136. $id = explode(',', $id);
  137. foreach ($id as $k => $v) {
  138. $info = Dever::db('order', 'seller')->find($v);
  139. if ($info['status'] < 10) {
  140. $newid[] = $v;
  141. if (!$info['order_num']) {
  142. $data['order_num'] = Dever::load('order', 'seller')->createOrder();
  143. //Dever::db('order', 'seller')->update($v, $update);
  144. }
  145. }
  146. }
  147. if (!$newid) {
  148. Dever::error('请选择未完成订单');
  149. }
  150. $newid = implode(',', $newid);
  151. $data['finish'] = 1;
  152. $data['finish_date'] = time();
  153. return array($newid, $data);
  154. }
  155. # 将订单插入到订单日志中
  156. public function addOrderLog($id, $data)
  157. {
  158. $id = explode(',', $id);
  159. foreach ($id as $k => $v) {
  160. $info = Dever::db('order', 'seller')->find($v);
  161. if ($info['status'] >= 10) {
  162. $msg = 'error';
  163. if ($info['status'] == 10) {
  164. $msg = 'ok';
  165. }
  166. $info['status'] = 2;
  167. Dever::load('order', 'seller')->notify($info, $msg, array(), 5, 2);
  168. }
  169. }
  170. }
  171. # 修改订单状态
  172. public function editOrderLog1($id, $data)
  173. {
  174. if ($data['status'] != 11) {
  175. Dever::error('请选择退款订单');
  176. }
  177. $newid = array();
  178. $id = explode(',', $id);
  179. foreach ($id as $k => $v) {
  180. $info = Dever::db('order_log1', 'seller')->find($v);
  181. if ($info['status'] == 10) {
  182. $newid[] = $v;
  183. }
  184. }
  185. if (!$newid) {
  186. Dever::error('请选择成功订单');
  187. }
  188. $newid = implode(',', $newid);
  189. return array($newid, $data);
  190. }
  191. public function upOrderLog1($id, $data)
  192. {
  193. if ($data['status'] != 11) {
  194. Dever::error('请选择退款订单');
  195. }
  196. $id = explode(',', $id);
  197. foreach ($id as $k => $v) {
  198. $info = Dever::db('order_log1', 'seller')->find($v);
  199. if ($info['status'] == 11) {
  200. Dever::load('info', 'seller')->inc($info['seller_id'], $info['price']);
  201. }
  202. }
  203. }
  204. # 后台充值、提现
  205. public function operCash($data)
  206. {
  207. if ($data['type'] == 1) {
  208. Dever::db('info', 'seller')->update($data['seller_id'], array('cash' => array('+', $data['cash']), 'p_cash' => array('+', $data['cash'])));
  209. } elseif ($data['type'] == 2) {
  210. Dever::load('info', 'seller')->dec($data['seller_id'], $data['cash']);
  211. $data['cash'] = -1*$data['cash'];
  212. }
  213. return $data;
  214. }
  215. # 展示订单信息
  216. public function showOrder($order_id)
  217. {
  218. $result = '';
  219. if ($order_id) {
  220. $order = Dever::db('order', 'seller')->find($order_id);
  221. if ($order) {
  222. $result = $order['order_num'];
  223. } else {
  224. $order = Dever::db('order_log1', 'seller')->find($order_id);
  225. if ($order) {
  226. $result = $order['order_num'];
  227. }
  228. }
  229. }
  230. return $result;
  231. }
  232. # 展示订单商品
  233. public function showOrderGoods($cate_id, $goods_id, $sku_id)
  234. {
  235. $goods = Dever::db('info', 'goods')->find($goods_id);
  236. $result = $goods['name'];
  237. return $result;
  238. }
  239. # 展示订单账号
  240. public function showOrderAccount($status, $account)
  241. {
  242. if (strstr($account, 'km_')) {
  243. if ($status == 10) {
  244. return '<a>提取卡密</a>';
  245. }
  246. }
  247. return $account;
  248. }
  249. # 展示订单金额
  250. public function showOrderCash($cate_id, $goods_id, $sku_id, $cash, $price, $buy_price, $num)
  251. {
  252. $goods = Dever::db('info', 'goods')->find($goods_id);
  253. $result = $goods['name'] . ' / ' . $cash . ' / ' . $price . ' / ' . $buy_price;
  254. return $result;
  255. }
  256. # 展示订单状态
  257. public function showOrderStatus($status)
  258. {
  259. $value = Dever::db('order', 'seller')->config['struct']['status']['value'][$status];
  260. if ($status < 10) {
  261. return $value;
  262. } elseif ($status == 10) {
  263. return '<span style="color:blue">'.$value.'</span>';
  264. } elseif ($status == 11) {
  265. return '<span style="color:red">'.$value.'</span>';
  266. }
  267. }
  268. # 展示订单统计信息
  269. public function showOrderStat($where)
  270. {
  271. /*
  272. $db = Dever::db('order', 'seller');
  273. $total = $db->count($where);
  274. $zongjine = $db->find($where, array('col' => 'sum(cash) as cash'));
  275. if (!$zongjine) {
  276. $zongjine['cash'] = 0;
  277. }
  278. $where['status'] = 10;
  279. $yes = $db->count($where);
  280. if ($total <= 0) {
  281. $lv = '0';
  282. } else {
  283. $lv = round($yes/$total*100, 2);
  284. }
  285. $czongjine = $db->find($where, array('col' => 'sum(cash) as cash'));
  286. $szongjine = $db->find($where, array('col' => 'sum(price) as cash'));
  287. $kzongjine = $db->find($where, array('col' => 'sum(buy_price) as cash'));
  288. if (!$czongjine) {
  289. $czongjine['cash'] = 0;
  290. }
  291. if (!$szongjine) {
  292. $szongjine['cash'] = 0;
  293. }
  294. if (!$kzongjine) {
  295. $kzongjine['cash'] = 0;
  296. }
  297. $lirun = $szongjine['cash'] - $kzongjine['cash'];
  298. $where['status'] = array('<', 10);
  299. $chu = $db->count($where);
  300. $where['status'] = 11;
  301. $shibaijine = $db->find($where, array('col' => 'sum(price) as cash'));
  302. if (!$shibaijine) {
  303. $shibaijine['cash'] = 0;
  304. }
  305. $shibai = $db->count($where);
  306. return array
  307. (
  308. array
  309. (
  310. 'span' => 3,
  311. 'name' => '处理中的笔数',
  312. 'value' => (float) $chu,
  313. ),
  314. array
  315. (
  316. 'span' => 3,
  317. 'name' => '失败的笔数',
  318. 'value' => (float) $shibai,
  319. ),
  320. array
  321. (
  322. 'span' => 3,
  323. 'name' => '成功的笔数',
  324. 'value' => (float) $yes,
  325. ),
  326. array
  327. (
  328. 'span' => 3,
  329. 'name' => '失败的金额',
  330. 'value' => (float) $shibaijine['cash'] ?? 0,
  331. ),
  332. array
  333. (
  334. 'span' => 3,
  335. 'name' => '成功的金额',
  336. 'value' => (float) $szongjine['cash'] ?? 0,
  337. ),
  338. array
  339. (
  340. 'span' => 3,
  341. 'name' => '成功比例',
  342. 'value' => (float) $lv,
  343. 'suffix' => '%',
  344. ),
  345. array
  346. (
  347. 'span' => 3,
  348. 'name' => '交易成本',
  349. 'value' => (float) $kzongjine['cash'] ?? 0,
  350. ),
  351. array
  352. (
  353. 'span' => 3,
  354. 'name' => '交易利润',
  355. 'value' => (float) $lirun ?? 0,
  356. ),
  357. );
  358. */
  359. $db = Dever::db('order', 'seller');
  360. $where['status'] = 10;
  361. $yes = $db->count($where);
  362. $szongjine = $db->find($where, array('col' => 'sum(price) as cash'));
  363. $kzongjine = $db->find($where, array('col' => 'sum(buy_price) as cash'));
  364. if (!$szongjine) {
  365. $szongjine['cash'] = 0;
  366. }
  367. if (!$kzongjine) {
  368. $kzongjine['cash'] = 0;
  369. }
  370. $lirun = $szongjine['cash'] - $kzongjine['cash'];
  371. $where['status'] = array('<', 10);
  372. $chu = $db->count($where);
  373. return array
  374. (
  375. array
  376. (
  377. 'span' => 4,
  378. 'name' => '处理中的笔数',
  379. 'value' => (float) $chu,
  380. ),
  381. array
  382. (
  383. 'span' => 4,
  384. 'name' => '成功的笔数',
  385. 'value' => (float) $yes,
  386. ),
  387. array
  388. (
  389. 'span' => 4,
  390. 'name' => '成功的金额',
  391. 'value' => (float) $szongjine['cash'] ?? 0,
  392. ),
  393. array
  394. (
  395. 'span' => 4,
  396. 'name' => '交易成本',
  397. 'value' => (float) $kzongjine['cash'] ?? 0,
  398. ),
  399. array
  400. (
  401. 'span' => 4,
  402. 'name' => '交易利润',
  403. 'value' => (float) $lirun ?? 0,
  404. ),
  405. );
  406. }
  407. # 展示账户统计信息
  408. public function showLogStat($where)
  409. {
  410. $db = Dever::db('info', 'seller');
  411. $where['id'] = $where['seller_id'];
  412. $info = $db->find($where);
  413. return array
  414. (
  415. array
  416. (
  417. # 一共24
  418. 'span' => 8,
  419. 'name' => '余额',
  420. 'value' => (float) $info['cash'],
  421. ),
  422. array
  423. (
  424. 'span' => 8,
  425. 'name' => '授信额度',
  426. 'value' => (float) $info['credit'],
  427. ),
  428. array
  429. (
  430. 'span' => 8,
  431. 'name' => '总充值金额',
  432. 'value' => (float) $info['p_cash'],
  433. ),
  434. );
  435. }
  436. # 展示订单扩展信息
  437. public function showOrderExpand($data)
  438. {
  439. $seller = Dever::db('info', 'seller')->find($data['seller_id']);
  440. $channel = array();
  441. if (isset($data['channel_id']) && $data['channel_id']) {
  442. $channel = Dever::db('info', 'channel')->find($data['channel_id']);
  443. }
  444. $value = $this->showOrderStatus($data['status']);
  445. $goods = $this->showOrderCash($data['cate_id'], $data['goods_id'], $data['sku_id'], $data['cash'], $data['price'], $data['buy_price'], $data['num']);
  446. $result['type'] = 'desc';
  447. if (strstr($data['account'], 'km_')) {
  448. $code = $this->kmPwd($data['id'], $data['cdate']);
  449. $tiqu = array('提取邮箱', '订单处理中,无法提取');
  450. /*
  451. $log['seller_id'] = $data['seller_id'];
  452. $log['order_id'] = $data['id'];
  453. $order_km = Dever::db('order_km', 'seller')->find($log);
  454. */
  455. if ($data['status'] == 10) {
  456. $tiqu = array('提取卡密', array
  457. (
  458. 'input' => '请输入邮箱',
  459. 'value' => $seller['email'],
  460. 'button' => '提取',
  461. 'remote' => Dever::url('seller/manage.tqKmManage', array('order_id' => $data['id'])),
  462. ));
  463. }
  464. $result['content'][] = array
  465. (
  466. 'title' => '卡密信息',
  467. 'border' => true,
  468. 'direction' => 'horizontal',
  469. 'size' => 'small',
  470. 'column' => 1,
  471. 'content' => array
  472. (
  473. array('提取密码', '<font style="color:red">' . $code . '</font>'),
  474. $tiqu,
  475. ),
  476. );
  477. }
  478. $result['content'][] = array
  479. (
  480. 'title' => '商户发起请求',
  481. 'border' => true,
  482. 'direction' => 'horizontal',
  483. 'size' => 'small',
  484. 'column' => 1,
  485. 'content' => array
  486. (
  487. array('商户名称', $seller['name']),
  488. array('商户订单号', $data['seller_order_num']),
  489. array('商品', $goods),
  490. array('数量', $data['num']),
  491. array('商户请求参数', $data['seller_request']),
  492. array('请求时间', date('Y-m-d H:i:s', $data['cdate'])),
  493. ),
  494. );
  495. $result['content'][] = array
  496. (
  497. 'title' => '系统下单',
  498. 'border' => true,
  499. 'direction' => 'horizontal',//'vertical' | 'horizontal'
  500. 'size' => 'small',//'' | 'large' | 'default' | 'small'
  501. 'column' => 1,
  502. 'content' => array
  503. (
  504. array('系统订单ID', $data['id']),
  505. array('系统订单号', $data['order_num']),
  506. array('订单状态', $value),
  507. ),
  508. );
  509. $order_error = Dever::db('order_error', 'seller')->select(array('order_num' => $data['order_num']), array('order' => 'id asc'));
  510. if ($order_error) {
  511. foreach ($order_error as $k => $v) {
  512. $error_channel = Dever::db('info', 'channel')->find($v['channel_id']);
  513. $content = $this->showOrderExpandContent($error_channel, $v);
  514. $result['content'][] = array
  515. (
  516. 'title' => '轮巡渠道失败信息-' . ($k+1),
  517. 'border' => true,
  518. 'direction' => 'horizontal',
  519. 'size' => 'small',
  520. 'column' => 1,
  521. 'content' => $content,
  522. );
  523. }
  524. }
  525. if ($channel) {
  526. $content = $this->showOrderExpandContent($channel, $data);
  527. $result['content'][] = array
  528. (
  529. 'title' => '当前渠道响应信息',
  530. 'border' => true,
  531. 'direction' => 'horizontal',
  532. 'size' => 'small',
  533. 'column' => 1,
  534. 'content' => $content,
  535. );
  536. }
  537. $result['content'][] = array
  538. (
  539. 'title' => '系统向商户发起回调',
  540. 'border' => true,
  541. 'direction' => 'horizontal',
  542. 'size' => 'small',
  543. 'column' => 1,
  544. 'content' => array
  545. (
  546. array('商户响应信息', $data['seller_callback']),
  547. array('响应时间', $data['seller_callback_date'] ? date('Y-m-d H:i:s', $data['seller_callback_date']) : '-'),
  548. array('响应次数', $data['seller_callback_num']),
  549. ),
  550. );
  551. return $result;
  552. }
  553. # 展示订单渠道内容
  554. public function showOrderExpandContent($channel, $info)
  555. {
  556. $content = array();
  557. $content[] = array('渠道名称', $channel['name']);
  558. $content[] = array('渠道地址', $channel['host']);
  559. if ($info['channel_order_num']) {
  560. $content[] = array('渠道订单号', $info['channel_order_num']);
  561. }
  562. $content[] = array('请求时间', $info['channel_order_date'] ? date('Y-m-d H:i:s', $info['channel_order_date']) : '-');
  563. if ($info['channel_request']) {
  564. $content[] = array('请求信息', $info['channel_request']);
  565. }
  566. if ($info['channel_response']) {
  567. $content[] = array('响应信息', $info['channel_response']);
  568. }
  569. if ($info['channel_callback']) {
  570. $content[] = array('回调信息', $info['channel_callback']);
  571. }
  572. if ($info['channel_callback_date']) {
  573. $content[] = array('回调时间', date('Y-m-d H:i:s', $info['channel_callback_date']));
  574. }
  575. if (isset($info['official_order_num']) && $info['official_order_num']) {
  576. $content[] = array('官方流水号', '<span>' . $info['official_order_num'] . '</span>');
  577. }
  578. if (isset($info['official_msg']) && $info['official_msg']) {
  579. $content[] = array('官方充值结果', $info['official_msg']);
  580. }
  581. return $content;
  582. }
  583. # 展示订单卡密扩展信息
  584. public function showOrderExpandKm($data)
  585. {
  586. if ($data && $data['status'] == 10 && strstr($data['account'], 'km_')) {
  587. $seller = Dever::db('info', 'seller')->find($data['seller_id']);
  588. $result['type'] = 'desc';
  589. $result['content'][] = array
  590. (
  591. 'title' => '提取卡密',
  592. 'border' => true,
  593. 'direction' => 'horizontal',
  594. 'size' => 'small',
  595. 'column' => 1,
  596. 'content' => array
  597. (
  598. array('提取邮箱', array
  599. (
  600. 'input' => '请输入邮箱',
  601. 'value' => $seller['email'],
  602. 'button' => '提取',
  603. 'remote' => Dever::url('seller/manage.tqKm', array('order_id' => $data['id'])),
  604. )),
  605. ),
  606. );
  607. $log = Dever::db('order_km', 'seller')->select(array('order_id' => $data['id']));
  608. $content = array();
  609. if ($log) {
  610. foreach ($log as $v) {
  611. if ($v['email']) {
  612. $v['admin_name'] .= ' 提取邮箱:' . $v['email'];
  613. }
  614. $content[] = array(date('Y-m-d H:i:s', $v['cdate']), '操作人:' . $v['admin_name']);
  615. }
  616. }
  617. $result['content'][] = array
  618. (
  619. 'title' => '提取记录',
  620. 'border' => true,
  621. 'direction' => 'horizontal',
  622. 'size' => 'small',
  623. 'column' => 1,
  624. 'content' => $content,
  625. );
  626. } else {
  627. $result['type'] = 'string';
  628. $result['content'] = '暂无信息';
  629. }
  630. return $result;
  631. }
  632. # 导出卡密
  633. public function outKm($data)
  634. {
  635. $result = array();
  636. $result['head'] = array('订单id', '订单号', '商品', '面值', '卡号', '密码', '有效期');
  637. $result['body'] = array();
  638. foreach ($data['body'] as $k => $v) {
  639. //$v['sku_id']
  640. $goods_name = Dever::load("manage", "goods")->showGoodsInfo($v['goods_id'], false);
  641. $card = Dever::db('card', 'channel')->select(array('order_id' => $v['id'], 'status' => 1));
  642. if ($card) {
  643. foreach ($card as $k1 => $v1) {
  644. $result['body'][] = array($v['id'], $v['order_num'], $goods_name, $v['cash'], $v1['number'], $v1['pwd'], $v1['end']);
  645. }
  646. }
  647. }
  648. return $result;
  649. }
  650. # 生成卡密密码
  651. public function kmPwd($id, $cdate)
  652. {
  653. $num = ($id + 1000000000);
  654. return md5(\Dever\Helper\Str::idtostr($num));
  655. }
  656. # 展示订单号
  657. public function showOrderListOrder($seller_order_num, $order_num)
  658. {
  659. if (!$order_num) {
  660. $order_num = '-';
  661. }
  662. return '商户订单号:' . $seller_order_num . '<br />系统订单号:' . $order_num;
  663. }
  664. # 展示订单商品
  665. public function showOrderListGoods($account, $cate_id, $goods_id, $sku_id, $cash, $price, $buy_price, $num)
  666. {
  667. $goods = Dever::db('info', 'goods')->find($goods_id);
  668. $result = '账号:' . $account . '<br />';
  669. $result .= '商品:' . $goods['name'] . '<br />';
  670. $result .= '面值:' . $cash . ' 销售价:' . $price . ' 成本价:' . $buy_price;
  671. return $result;
  672. }
  673. }