order.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. 'buy_id' => array
  173. (
  174. 'type' => 'int-11',
  175. 'name' => '购买本数',
  176. 'default' => '',
  177. 'desc' => '购买本数',
  178. 'match' => 'is_numeric',
  179. 'update' => 'select',
  180. 'option' => $buy,
  181. //'search' => 'select',
  182. //'list' => true,
  183. ),
  184. 'buy_num' => array
  185. (
  186. 'type' => 'int-11',
  187. 'name' => '购买本数',
  188. 'default' => '',
  189. 'desc' => '购买本数',
  190. 'match' => 'is_numeric',
  191. //'search' => 'select',
  192. //'list' => true,
  193. ),
  194. 'type' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '支付方式',
  198. 'default' => '1',
  199. 'desc' => '支付方式',
  200. 'match' => 'is_numeric',
  201. 'option' => $type,
  202. 'search' => 'select',
  203. 'update' => 'radio',
  204. //'list' => true,
  205. 'control' => 'type',
  206. ),
  207. 'system' => array
  208. (
  209. 'type' => 'int-11',
  210. 'name' => '系统',
  211. 'default' => '1',
  212. 'desc' => '系统',
  213. 'match' => 'is_numeric',
  214. 'option' => $system,
  215. 'search' => 'select',
  216. 'update' => 'radio',
  217. 'list' => true,
  218. ),
  219. 'source' => array
  220. (
  221. 'type' => 'int-11',
  222. 'name' => '渠道来源',
  223. 'default' => '1',
  224. 'desc' => '支付方式',
  225. 'match' => 'is_numeric',
  226. 'option' => $source,
  227. 'search' => 'select',
  228. 'update' => 'radio',
  229. 'list' => true,
  230. ),
  231. 'seller_id' => array
  232. (
  233. 'type' => 'int-11',
  234. 'name' => '销售商',
  235. 'default' => '1',
  236. 'desc' => '销售商',
  237. 'match' => 'is_numeric',
  238. 'update' => 'select',
  239. 'option' => $seller,
  240. 'search' => 'select',
  241. //'list' => true,
  242. ),
  243. 'notice' => array
  244. (
  245. 'type' => 'int-11',
  246. 'name' => '模板消息提醒次数',
  247. 'default' => '0',
  248. 'desc' => '模板消息提醒次数',
  249. 'match' => 'is_numeric',
  250. ),
  251. 'cash' => array
  252. (
  253. 'type' => 'varchar-50',
  254. 'name' => '支付金额',
  255. 'default' => '',
  256. 'desc' => '支付金额',
  257. 'match' => 'option',
  258. 'update' => 'text',
  259. //'list' => true,
  260. 'show' => 'type=1',
  261. ),
  262. 'code' => array
  263. (
  264. 'type' => 'varchar-50',
  265. 'name' => '使用的兑换码',
  266. 'default' => '',
  267. 'desc' => '使用的兑换码',
  268. 'match' => 'option',
  269. 'update' => 'text',
  270. //'list' => true,
  271. 'show' => 'type=2',
  272. ),
  273. 'status' => array
  274. (
  275. 'type' => 'tinyint-1',
  276. 'name' => '订单状态',
  277. 'default' => '1',
  278. 'desc' => '请选择订单状态',
  279. 'match' => 'is_numeric',
  280. 'option' => $status,
  281. 'search' => 'select',
  282. 'update' => 'radio',
  283. 'list' => 'Dever::load("journal/lib/manage.showOrderStatusV1", "{id}")',
  284. 'control' => 'status',
  285. ),
  286. 'tk_pic' => array
  287. (
  288. 'type' => 'varchar-150',
  289. 'name' => '退款截图',
  290. 'default' => '',
  291. 'desc' => '退款截图',
  292. 'match' => 'is_string',
  293. 'update' => 'image',
  294. 'key' => 1
  295. ),
  296. 'tk_time' => array
  297. (
  298. 'type' => 'int-11',
  299. 'name' => '退款时间',
  300. 'default' => '',
  301. 'desc' => '退款时间',
  302. 'match' => 'option',
  303. //'list' => true,
  304. //'update' => 'date',
  305. 'callback' => 'maketime',
  306. 'show' => 'status=5',
  307. ),
  308. 'tk_admin' => array
  309. (
  310. 'type' => 'int-11',
  311. 'name' => '退款审核人',
  312. 'default' => '1',
  313. 'desc' => '退款审核人',
  314. 'match' => 'option',
  315. //'list' => true,
  316. 'show' => 'status=5',
  317. ),
  318. 'tk_desc' => array
  319. (
  320. 'type' => 'varchar-300',
  321. 'name' => '退款备注',
  322. 'default' => '',
  323. 'desc' => '退款备注',
  324. 'match' => 'option',
  325. 'update' => 'textarea',
  326. //'show' => 'status=5',
  327. ),
  328. 'state' => array
  329. (
  330. 'type' => 'tinyint-1',
  331. 'name' => '状态',
  332. 'default' => '1',
  333. 'desc' => '请选择状态',
  334. 'match' => 'is_numeric',
  335. ),
  336. 'cdate' => array
  337. (
  338. 'type' => 'int-11',
  339. 'name' => '下单时间',
  340. 'match' => array('is_numeric', time()),
  341. 'desc' => '',
  342. # 只有insert时才生效
  343. 'insert' => true,
  344. 'search' => 'date',
  345. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  346. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  347. ),
  348. 'info' => array
  349. (
  350. 'type' => 'varchar-300',
  351. 'name' => '备注',
  352. 'default' => '',
  353. 'desc' => '备注',
  354. 'match' => 'option',
  355. 'update' => 'textarea',
  356. //'show' => 'status=5'
  357. //'list' => '"{info}" ? "{info}" : "双击添加备注"',
  358. //'edit' => true,
  359. ),
  360. 'mobile' => array
  361. (
  362. 'type' => 'varchar-300',
  363. 'name' => '手机号',
  364. 'default' => '',
  365. 'desc' => '手机号',
  366. 'match' => 'option',
  367. //'show' => 'status=5'
  368. 'search' => array
  369. (
  370. 'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
  371. 'col' => 'mobile',//要查询的字段
  372. 'result' => 'id',//返回的字段
  373. 'search' => 'uid',//本表的字段,默认为当前的字段
  374. ),
  375. ),
  376. ),
  377. 'top' => Dever::config('base')->top,
  378. # 增加这个,为了给当前的list增加一个option
  379. 'top_option' => array
  380. (
  381. 'value' => $auth,
  382. 'col' => 'cate_id',
  383. ),
  384. 'manage' => array
  385. (
  386. 'delete' => false,
  387. 'edit' => false,
  388. 'insert' => false,
  389. 'button' => array
  390. (
  391. //'导出订单' => array('location', 'journal/lib/manage.out'),
  392. ),
  393. 'list_button' => array(
  394. 'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} >= 2 && ({type} == 1 || {type} == 3)'),
  395. //'delete' => array('删除', '', '{status} == 1'),
  396. ),
  397. ),
  398. 'request' => array
  399. (
  400. 'getAll' => array
  401. (
  402. # 匹配的正则或函数 选填项
  403. 'option' => array
  404. (
  405. 'type' => 'yes',
  406. 'create_uid' => 'yes',
  407. 'status' => array('1', '!='),
  408. 'uid' => 'yes',
  409. 'state' => 1,
  410. ),
  411. 'type' => 'all',
  412. 'order' => array('cdate' => 'desc'),
  413. 'page' => array(10, 'list'),
  414. 'col' => '*',
  415. ),
  416. 'getYes' => array
  417. (
  418. # 匹配的正则或函数 选填项
  419. 'option' => array
  420. (
  421. 'product_id' => 'yes',
  422. 'state' => 1,
  423. ),
  424. 'type' => 'all',
  425. 'order' => array('cdate' => 'desc'),
  426. 'col' => '*',
  427. ),
  428. # 获取提交订单超过12个小时
  429. 'getDataByTime' => array
  430. (
  431. # 匹配的正则或函数 选填项
  432. 'option' => array
  433. (
  434. 'cdate' => array('yes', '>='),
  435. 'notice' => 'yes',
  436. 'note' => 'yes',
  437. 'type' => array('yes', 'in'),
  438. 'state' => 1,
  439. ),
  440. 'type' => 'all',
  441. 'order' => array('cdate' => 'desc'),
  442. 'col' => '*',
  443. ),
  444. # 获取没有兑换码的订单
  445. 'getUnCode' => array
  446. (
  447. # 匹配的正则或函数 选填项
  448. 'option' => array
  449. (
  450. 'code' => array('yes', '='),
  451. 'status' => 'yes',
  452. 'type' => 'yes',
  453. 'state' => 1,
  454. ),
  455. 'type' => 'all',
  456. 'order' => array('id' => 'desc'),
  457. 'limit' => '0,100',
  458. 'col' => '*',
  459. ),
  460. # 获取1,2
  461. 'getBuy' => array
  462. (
  463. # 匹配的正则或函数 选填项
  464. 'option' => array
  465. (
  466. 'status' => 'yes',
  467. 'type' => array('yes', 'in'),
  468. 'product_id' => 'yes',
  469. 'order_id' => 'yes',
  470. 'uid' => 'yes',
  471. 'state' => 1,
  472. ),
  473. 'type' => 'all',
  474. 'order' => array('id' => 'desc'),
  475. 'col' => '*',
  476. ),
  477. 'getMyAll' => array
  478. (
  479. # 匹配的正则或函数 选填项
  480. 'option' => array
  481. (
  482. 'type' => 'yes',
  483. 'uid' => 'yes',
  484. 'status' => 'yes',
  485. 'cate_id' => 'yes',
  486. 'state' => 1,
  487. ),
  488. 'type' => 'all',
  489. 'order' => array('id' => 'desc'),
  490. 'page' => array(10, 'list'),
  491. 'col' => 'id,order_id,name,buy_num,cdate,cash,product_id,buy_id',
  492. ),
  493. # 删除未支付订单
  494. 'drop' => array
  495. (
  496. # 匹配的正则或函数 选填项
  497. 'where' => array
  498. (
  499. 'time' => array('yes-cdate', '<='),
  500. 'status' => 1,
  501. 'state' => 1,
  502. ),
  503. 'type' => 'delete',
  504. 'col' => 'id,order_id',
  505. ),
  506. # 获取数据
  507. 'getAllByDate' => array
  508. (
  509. # 匹配的正则或函数 选填项
  510. 'where' => array
  511. (
  512. 'time' => array('yes-cdate', '<='),
  513. ),
  514. 'type' => 'all',
  515. 'col' => 'id,order_id',
  516. ),
  517. ),
  518. );