Cuscontract.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\admin\controller\qingdong\customer;
  3. use app\admin\controller\qingdong\Base;
  4. use think\Db;
  5. use think\Exception;
  6. /**
  7. * 合同管理
  8. * 操作文档:https://doc.fastadmin.net/qingdong
  9. * 软件介绍:https://www.fastadmin.net/store/qingdong.html
  10. * 售后微信:qingdong_crm
  11. */
  12. class Cuscontract extends Base {
  13. protected $relationSearch = true;
  14. /**
  15. * @var \addons\qingdong\model\Contract
  16. */
  17. protected $model = null;
  18. public function _initialize() {
  19. parent::_initialize();
  20. $this->model = new \addons\qingdong\model\Contract;
  21. }
  22. /**
  23. * 查看
  24. */
  25. public function index() {
  26. //设置过滤方法
  27. if ($this->request->isAjax()) {
  28. $params = $this->request->get();
  29. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  30. $wheres = [];
  31. $wheres['customer_id'] = $params['ids'];
  32. $list = $this->model->where($where)->where($wheres)
  33. ->with([
  34. 'customer',
  35. 'orderStaff',
  36. 'contacts',
  37. 'contractOther'
  38. ])->order($sort, $order)->paginate($limit);
  39. $data = $list->items();
  40. foreach($data as &$v){
  41. $contract_remark='';
  42. $contract_other = $v['contract_other'];
  43. $otherdata = json_decode($contract_other['otherdata'],true);
  44. if(is_array($otherdata)){
  45. if(isset($otherdata['other_upnhey'])){
  46. $contract_remark = $otherdata['other_upnhey'];
  47. }
  48. if(isset($otherdata['other_zdywys'])){
  49. $contract_remark = $otherdata['other_zdywys'];
  50. }
  51. }
  52. $v['contract_remark'] = $contract_remark;
  53. // outFileLog($contract_remark,'cus_contract','$v');
  54. }
  55. $result = array("total" => $list->total(), "rows" => $list->items());
  56. return json($result);
  57. }
  58. return $this->view->fetch();
  59. }
  60. }