Sellercost.php 2.2 KB

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