order.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <?php
  2. $type = array
  3. (
  4. //1 => '购买小刊',
  5. //2 => '兑换小刊',
  6. 3 => '购买兑换码',
  7. //4 => '使用通用兑换码',
  8. );
  9. # 系统
  10. $system = array
  11. (
  12. 1 => '小程序',
  13. 2 => 'H5',
  14. 3 => 'ios',
  15. 4 => '安卓',
  16. );
  17. # 渠道
  18. $source = function()
  19. {
  20. return Dever::db('source/info')->state();
  21. };
  22. $status = array
  23. (
  24. 1 => '待支付',
  25. 2 => '已支付',
  26. 3 => '支付失败',
  27. //4 => '申请退款',
  28. 5 => '已退款',
  29. );
  30. $product = function()
  31. {
  32. return Dever::db('journal/info')->state();
  33. };
  34. $buy = function()
  35. {
  36. return Dever::db('journal/buy_num')->state();
  37. };
  38. # 获取小刊分类权限
  39. $auth = Dever::tops();
  40. $cate = function() use ($auth)
  41. {
  42. $array = array();
  43. if ($auth) {
  44. $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
  45. } else {
  46. $info = Dever::db('journal/cate')->state();
  47. }
  48. if($info)
  49. {
  50. $array += $info;
  51. }
  52. return $array;
  53. };
  54. $seller = function()
  55. {
  56. return Dever::db('code/seller')->state();
  57. };
  58. return array
  59. (
  60. # 表名
  61. 'name' => 'order',
  62. # 显示给用户看的名称
  63. 'lang' => '订单管理',
  64. 'order' => 1,
  65. 'menu' => 'journal',
  66. 'end' => array
  67. (
  68. 'update' => 'act/lib/pay.order',
  69. ),
  70. # 数据结构
  71. 'struct' => array
  72. (
  73. 'id' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => 'ID',
  77. 'default' => '',
  78. 'desc' => '',
  79. 'match' => 'is_numeric',
  80. 'search' => 'order',
  81. //'list' => true,
  82. ),
  83. 'order_id' => array
  84. (
  85. 'type' => 'varchar-100',
  86. 'name' => '支付订单ID/订单表ID',
  87. 'default' => '',
  88. 'desc' => '付款订单id',
  89. 'match' => 'is_string',
  90. 'update' => 'text',
  91. 'search' => 'fulltext',
  92. //'list' => true,
  93. 'list' => 'Dever::load("act/order.getOrderId", {id})',
  94. ),
  95. 'cate_journal' => array
  96. (
  97. 'name' => '小刊',
  98. 'default' => '',
  99. 'desc' => '小刊',
  100. 'search' => 'linkage',
  101. 'search_col' => 'cate_id,product_id',
  102. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  103. ),
  104. 'cate_id' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '小刊分类',
  108. 'default' => '1',
  109. 'desc' => '小刊分类',
  110. 'match' => 'is_numeric',
  111. 'update' => 'select',
  112. 'option' => $cate,
  113. //'search' => 'select',
  114. 'list' => true,
  115. ),
  116. 'name' => array
  117. (
  118. 'type' => 'varchar-80',
  119. 'name' => '订单名称',
  120. 'default' => '',
  121. 'desc' => '订单名称',
  122. 'match' => 'is_string',
  123. 'update' => 'text',
  124. 'search' => 'fulltext',
  125. 'list_name' => '订单信息',
  126. 'list' => 'Dever::load("journal/lib/manage.showOrderUserV1", "{id}")',
  127. ),
  128. 'uid' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '用户名',
  132. 'default' => '',
  133. 'desc' => '用户id',
  134. 'match' => 'is_numeric',
  135. 'search' => array
  136. (
  137. 'api' => 'passport/user-all',
  138. 'col' => 'username',
  139. 'result' => 'id',
  140. ),
  141. 'update' => 'text',
  142. ),
  143. 'source_uid' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '邀请人',
  147. 'default' => '',
  148. 'desc' => '邀请人',
  149. 'match' => 'is_numeric',
  150. 'update' => 'text',
  151. ),
  152. 'note' => array
  153. (
  154. 'type' => 'tinyint-1',
  155. 'name' => '是否发送状态提醒-1未发送,2已发送',
  156. 'default' => '1',
  157. 'desc' => '请选择状态',
  158. 'match' => 'is_numeric',
  159. ),
  160. 'product_id' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '小刊',
  164. 'default' => '',
  165. 'desc' => '小刊',
  166. 'match' => 'is_numeric',
  167. 'update' => 'select',
  168. 'option' => $product,
  169. //'search' => 'select',
  170. //'list' => true,
  171. ),
  172. 'star_id' => array
  173. (
  174. 'type' => 'int-11',
  175. 'name' => '明星',
  176. 'default' => '',
  177. 'desc' => '明星',
  178. 'match' => 'is_numeric',
  179. 'update' => 'select',
  180. //'search' => 'select',
  181. //'list' => true,
  182. ),
  183. 'buy_id' => array
  184. (
  185. 'type' => 'int-11',
  186. 'name' => '购买本数',
  187. 'default' => '',
  188. 'desc' => '购买本数',
  189. 'match' => 'is_numeric',
  190. 'update' => 'select',
  191. 'option' => $buy,
  192. //'search' => 'select',
  193. //'list' => true,
  194. ),
  195. 'buy_num' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '购买本数',
  199. 'default' => '',
  200. 'desc' => '购买本数',
  201. 'match' => 'is_numeric',
  202. //'search' => 'select',
  203. //'list' => true,
  204. ),
  205. 'type' => array
  206. (
  207. 'type' => 'int-11',
  208. 'name' => '支付方式',
  209. 'default' => '1',
  210. 'desc' => '支付方式',
  211. 'match' => 'is_numeric',
  212. 'option' => $type,
  213. 'search' => 'select',
  214. 'update' => 'radio',
  215. //'list' => true,
  216. 'control' => 'type',
  217. ),
  218. 'system' => array
  219. (
  220. 'type' => 'int-11',
  221. 'name' => '系统',
  222. 'default' => '1',
  223. 'desc' => '系统',
  224. 'match' => 'is_numeric',
  225. 'option' => $system,
  226. 'search' => 'select',
  227. 'update' => 'radio',
  228. 'list' => true,
  229. ),
  230. 'source' => array
  231. (
  232. 'type' => 'int-11',
  233. 'name' => '渠道来源',
  234. 'default' => '1',
  235. 'desc' => '支付方式',
  236. 'match' => 'is_numeric',
  237. 'option' => $source,
  238. 'search' => 'select',
  239. 'update' => 'radio',
  240. 'list' => true,
  241. ),
  242. 'seller_id' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '销售商',
  246. 'default' => '1',
  247. 'desc' => '销售商',
  248. 'match' => 'is_numeric',
  249. 'update' => 'select',
  250. 'option' => $seller,
  251. 'search' => 'select',
  252. //'list' => true,
  253. ),
  254. 'notice' => array
  255. (
  256. 'type' => 'int-11',
  257. 'name' => '模板消息提醒次数',
  258. 'default' => '0',
  259. 'desc' => '模板消息提醒次数',
  260. 'match' => 'is_numeric',
  261. ),
  262. 'cash' => array
  263. (
  264. 'type' => 'varchar-50',
  265. 'name' => '支付金额',
  266. 'default' => '',
  267. 'desc' => '支付金额',
  268. 'match' => 'option',
  269. 'update' => 'text',
  270. //'list' => true,
  271. 'show' => 'type=1',
  272. ),
  273. 'code' => array
  274. (
  275. 'type' => 'varchar-50',
  276. 'name' => '使用的兑换码',
  277. 'default' => '',
  278. 'desc' => '使用的兑换码',
  279. 'match' => 'option',
  280. 'update' => 'text',
  281. //'list' => true,
  282. 'show' => 'type=2',
  283. ),
  284. 'status' => array
  285. (
  286. 'type' => 'tinyint-1',
  287. 'name' => '订单状态',
  288. 'default' => '1',
  289. 'desc' => '请选择订单状态',
  290. 'match' => 'is_numeric',
  291. 'option' => $status,
  292. 'search' => 'select',
  293. 'update' => 'radio',
  294. 'list' => 'Dever::load("journal/lib/manage.showOrderStatusV1", "{id}")',
  295. 'control' => 'status',
  296. ),
  297. 'tk_pic' => array
  298. (
  299. 'type' => 'varchar-150',
  300. 'name' => '退款截图',
  301. 'default' => '',
  302. 'desc' => '退款截图',
  303. 'match' => 'is_string',
  304. 'update' => 'image',
  305. 'key' => 1
  306. ),
  307. 'tk_time' => array
  308. (
  309. 'type' => 'int-11',
  310. 'name' => '退款时间',
  311. 'default' => '',
  312. 'desc' => '退款时间',
  313. 'match' => 'option',
  314. //'list' => true,
  315. //'update' => 'date',
  316. 'callback' => 'maketime',
  317. 'show' => 'status=5',
  318. ),
  319. 'tk_admin' => array
  320. (
  321. 'type' => 'int-11',
  322. 'name' => '退款审核人',
  323. 'default' => '1',
  324. 'desc' => '退款审核人',
  325. 'match' => 'option',
  326. //'list' => true,
  327. 'show' => 'status=5',
  328. ),
  329. 'tk_desc' => array
  330. (
  331. 'type' => 'varchar-300',
  332. 'name' => '退款备注',
  333. 'default' => '',
  334. 'desc' => '退款备注',
  335. 'match' => 'option',
  336. 'update' => 'textarea',
  337. //'show' => 'status=5',
  338. ),
  339. 'state' => array
  340. (
  341. 'type' => 'tinyint-1',
  342. 'name' => '状态',
  343. 'default' => '1',
  344. 'desc' => '请选择状态',
  345. 'match' => 'is_numeric',
  346. ),
  347. 'cdate' => array
  348. (
  349. 'type' => 'int-11',
  350. 'name' => '下单时间',
  351. 'match' => array('is_numeric', time()),
  352. 'desc' => '',
  353. # 只有insert时才生效
  354. 'insert' => true,
  355. 'search' => 'date',
  356. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  357. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  358. ),
  359. 'info' => array
  360. (
  361. 'type' => 'varchar-300',
  362. 'name' => '备注',
  363. 'default' => '',
  364. 'desc' => '备注',
  365. 'match' => 'option',
  366. 'update' => 'textarea',
  367. //'show' => 'status=5'
  368. //'list' => '"{info}" ? "{info}" : "双击添加备注"',
  369. //'edit' => true,
  370. ),
  371. 'mobile' => array
  372. (
  373. 'type' => 'varchar-300',
  374. 'name' => '手机号',
  375. 'default' => '',
  376. 'desc' => '手机号',
  377. 'match' => 'option',
  378. //'show' => 'status=5'
  379. 'search' => array
  380. (
  381. 'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
  382. 'col' => 'mobile',//要查询的字段
  383. 'result' => 'id',//返回的字段
  384. 'search' => 'uid',//本表的字段,默认为当前的字段
  385. ),
  386. ),
  387. ),
  388. 'top' => Dever::config('base')->top,
  389. # 增加这个,为了给当前的list增加一个option
  390. 'top_option' => array
  391. (
  392. 'value' => $auth,
  393. 'col' => 'cate_id',
  394. ),
  395. 'manage' => array
  396. (
  397. 'delete' => false,
  398. 'edit' => false,
  399. 'insert' => false,
  400. 'button' => array
  401. (
  402. //'导出订单' => array('location', 'journal/lib/manage.out'),
  403. ),
  404. 'list_button' => array(
  405. 'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} >= 2 && ({type} == 1 || {type} == 3)'),
  406. //'delete' => array('删除', '', '{status} == 1'),
  407. ),
  408. ),
  409. 'request' => array
  410. (
  411. 'getAll' => array
  412. (
  413. # 匹配的正则或函数 选填项
  414. 'option' => array
  415. (
  416. 'type' => 'yes',
  417. 'create_uid' => 'yes',
  418. 'status' => array('1', '!='),
  419. 'uid' => 'yes',
  420. 'state' => 1,
  421. ),
  422. 'type' => 'all',
  423. 'order' => array('cdate' => 'desc'),
  424. 'page' => array(10, 'list'),
  425. 'col' => '*',
  426. ),
  427. 'getYes' => array
  428. (
  429. # 匹配的正则或函数 选填项
  430. 'option' => array
  431. (
  432. 'product_id' => 'yes',
  433. 'state' => 1,
  434. ),
  435. 'type' => 'all',
  436. 'order' => array('cdate' => 'desc'),
  437. 'col' => '*',
  438. ),
  439. # 获取提交订单超过12个小时
  440. 'getDataByTime' => array
  441. (
  442. # 匹配的正则或函数 选填项
  443. 'option' => array
  444. (
  445. 'cdate' => array('yes', '>='),
  446. 'notice' => 'yes',
  447. 'note' => 'yes',
  448. 'type' => array('yes', 'in'),
  449. 'state' => 1,
  450. ),
  451. 'type' => 'all',
  452. 'order' => array('cdate' => 'desc'),
  453. 'col' => '*',
  454. ),
  455. # 获取没有兑换码的订单
  456. 'getUnCode' => array
  457. (
  458. # 匹配的正则或函数 选填项
  459. 'option' => array
  460. (
  461. 'code' => array('yes', '='),
  462. 'status' => 'yes',
  463. 'type' => 'yes',
  464. 'state' => 1,
  465. ),
  466. 'type' => 'all',
  467. 'order' => array('id' => 'desc'),
  468. 'limit' => '0,100',
  469. 'col' => '*',
  470. ),
  471. # 获取1,2
  472. 'getBuy' => array
  473. (
  474. # 匹配的正则或函数 选填项
  475. 'option' => array
  476. (
  477. 'status' => 'yes',
  478. 'type' => array('yes', 'in'),
  479. 'product_id' => 'yes',
  480. 'order_id' => 'yes',
  481. 'uid' => 'yes',
  482. 'state' => 1,
  483. ),
  484. 'type' => 'all',
  485. 'order' => array('id' => 'desc'),
  486. 'col' => '*',
  487. ),
  488. 'getMyAll' => array
  489. (
  490. # 匹配的正则或函数 选填项
  491. 'option' => array
  492. (
  493. 'type' => 'yes',
  494. 'uid' => 'yes',
  495. 'status' => 'yes',
  496. 'cate_id' => 'yes',
  497. 'state' => 1,
  498. ),
  499. 'type' => 'all',
  500. 'order' => array('id' => 'desc'),
  501. 'page' => array(10, 'list'),
  502. 'col' => 'id,order_id,name,buy_num,cdate,cash,product_id,buy_id',
  503. ),
  504. # 删除未支付订单
  505. 'drop' => array
  506. (
  507. # 匹配的正则或函数 选填项
  508. 'where' => array
  509. (
  510. 'time' => array('yes-cdate', '<='),
  511. 'status' => 1,
  512. 'state' => 1,
  513. ),
  514. 'type' => 'delete',
  515. 'col' => 'id,order_id',
  516. ),
  517. # 获取数据
  518. 'getAllByDate' => array
  519. (
  520. # 匹配的正则或函数 选填项
  521. 'where' => array
  522. (
  523. 'time' => array('yes-cdate', '<='),
  524. ),
  525. 'type' => 'all',
  526. 'col' => 'id,order_id',
  527. ),
  528. 'getNumByJournal' => array
  529. (
  530. # 匹配的正则或函数 选填项
  531. 'option' => array
  532. (
  533. 'product_id' => 'yes',
  534. 'state' => 1,
  535. ),
  536. 'type' => 'one',
  537. 'col' => 'sum(buy_num) as buy_num',
  538. ),
  539. 'getNumByStar' => array
  540. (
  541. # 匹配的正则或函数 选填项
  542. 'option' => array
  543. (
  544. 'star_id' => 'yes',
  545. 'product_id' => 'yes',
  546. 'state' => 1,
  547. ),
  548. 'type' => 'one',
  549. 'col' => 'sum(buy_num) as buy_num',
  550. ),
  551. ),
  552. );