Sellerlog.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 卖家日志控制器
  14. */
  15. class Sellerlog extends MobileSeller {
  16. public function initialize() {
  17. parent::initialize();
  18. }
  19. /**
  20. * @api {POST} api/Sellerlog/log_list 店铺日志列表
  21. * @apiVersion 1.0.0
  22. * @apiGroup Sellerlog
  23. *
  24. * @apiHeader {String} X-DS-KEY 卖家授权token
  25. *
  26. * @apiParam {Int} cate_id 分类ID
  27. * @apiParam {String} seller_name 卖家账号
  28. * @apiParam {String} log_content 日志内容
  29. * @apiParam {String} add_time_from 开始时间 YYYY-MM-DD
  30. * @apiParam {String} add_time_to 结束时间 YYYY-MM-DD
  31. * @apiParam {Int} page 页码
  32. * @apiParam {Int} pagesize 每页显示数量
  33. *
  34. * @apiSuccess {String} code 返回码,10000为成功
  35. * @apiSuccess {String} message 返回消息
  36. * @apiSuccess {Object} result 返回数据
  37. * @apiSuccess {Object[]} result.log_list 日志列表 (返回字段参考sellerlog表)
  38. * @apiSuccess {Int} result.page_total 总页数
  39. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  40. */
  41. public function log_list() {
  42. $sellerlog_model = model('sellerlog');
  43. $condition = array();
  44. $condition[] = array('sellerlog_store_id', '=', $this->store_info['store_id']);
  45. $seller_name = input('param.seller_name');
  46. $log_content = input('param.log_content');
  47. $add_time_from = input('param.add_time_from');
  48. $add_time_to = input('param.add_time_to');
  49. if (!empty($seller_name)) {
  50. $condition[] = array('sellerlog_seller_name', 'like', '%' . input('param.seller_name') . '%');
  51. }
  52. if (!empty($log_content)) {
  53. $condition[] = array('sellerlog_content', 'like', '%' . $log_content . '%');
  54. }
  55. if (!empty($add_time_from) || $add_time_to) {
  56. $condition[] = array('sellerlog_time', 'between', [strtotime($add_time_from), strtotime($add_time_to)]);
  57. }
  58. $log_list = $sellerlog_model->getSellerlogList($condition, 10, 'sellerlog_id desc');
  59. $result = array_merge(array('log_list' => $log_list), mobile_page($sellerlog_model->page_info));
  60. ds_json_encode(10000, lang('ds_common_op_succ'), $result);
  61. }
  62. }