1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace addons\qingdongams\controller;
- use addons\qingdongams\model\Equipment as EquipmentModel;
- /**
- * @desc 操作文档:https://doc.fastadmin.net/qingdongams
- * @desc 软件介绍:https://www.fastadmin.net/store/qingdongams.html
- * @desc 售后微信:qingdong_crm
- */
- /**
- * 产品设备
- */
- class Equipment extends StaffApi {
- protected $noNeedLogin = [];
- protected $noNeedRight = [];
- //获取设备详情
- public function getEquipDetail(){
- $code = input('code','');
- if(!$code){
- $this->error('缺少参数设备码!');
- }
- // 设备详情
- $product = EquipmentModel::where(['number'=>$code])->with(['product','customerProduct'=>['customer']])->find();
- if(empty($product)){
- $this->error('产品信息不存在');
- }
- $workLogistic = [];
- // 工单维修记录
- if(isset($product['customer_product']['cid'])){
- $cid = intval($product['customer_product']['cid']);
- $where="FIND_IN_SET($cid, w.customer_product_id)";
- $workLogistic = \addons\qingdongams\model\Workorder::alias('w')
- ->where($where)->join('qingdongams_workorder_logistics','l.workorder_id=w.id','left')->order('w.id asc')->select();
- }
- $data = [
- 'info' => $product,
- 'logic' => $workLogistic
- ];
- $this->success('请求成功',$data);
- }
- }
|