Sellercost.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 店铺花费控制器
  13. */
  14. class Sellercost extends MobileSeller
  15. {
  16. public function initialize()
  17. {
  18. parent::initialize();
  19. }
  20. /**
  21. * @api {POST} api/Sellercost/cost_list 店铺花费列表
  22. * @apiVersion 1.0.0
  23. * @apiGroup Sellercost
  24. *
  25. * @apiHeader {String} X-DS-KEY 卖家授权token
  26. *
  27. * @apiParam {String} storecost_remark 日志内容
  28. * @apiParam {String} add_time_from 开始时间 YYYY-MM-DD
  29. * @apiParam {String} add_time_to 结束时间 YYYY-MM-DD
  30. * @apiParam {Int} page 页码
  31. * @apiParam {Int} pagesize 每页显示数量
  32. *
  33. * @apiSuccess {String} code 返回码,10000为成功
  34. * @apiSuccess {String} message 返回消息
  35. * @apiSuccess {Object} result 返回数据
  36. * @apiSuccess {Object[]} result.cost_list 花费列表 (返回字段参考storecost表)
  37. * @apiSuccess {Int} result.page_total 总页数
  38. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  39. */
  40. public function cost_list()
  41. {
  42. $storecost_model = model('storecost');
  43. $condition = array();
  44. $condition[] = array('storecost_store_id', '=', $this->store_info['store_id']);
  45. $storecost_remark = input('param.storecost_remark');
  46. if (!empty($storecost_remark)) {
  47. $condition[] = array('storecost_remark', 'like', '%' . $storecost_remark . '%');
  48. }
  49. $add_time_from = input('param.add_time_from');
  50. $add_time_to = input('param.add_time_to');
  51. if (!empty($add_time_from) && !empty($add_time_to)) {
  52. $condition[] = array('storecost_time', 'between', array(strtotime($add_time_from), strtotime($add_time_to)));
  53. }
  54. $cost_list = $storecost_model->getStorecostList($condition, 10, 'storecost_id desc');
  55. $result = array_merge(array('cost_list' => $cost_list), mobile_page($storecost_model->page_info));
  56. ds_json_encode(10000, lang('ds_common_op_succ'), $result);
  57. }
  58. }