Ejemplo n.º 1
0
 public function c($rq = null)
 {
     $type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
     $rq = rq();
     $rq['senderid'] = uid();
     $rq['sendername'] = username();
     if (he_is('agency')) {
         $rq['org'] = sess('org');
     }
     if (he_is('employee')) {
         $rq['org'] = sess('org');
     }
     // return his_chara()[0];
     $rq['sendertype'] = $type[his_chara()[0]];
     if (his_chara()[0] == 'agency') {
         $rq['recipienttype'] = 1;
         $rq['recipientid'] = 1;
         $rq['recipientname'] = 'admin';
     } elseif (his_chara()[0] == 'employee') {
         $rq['recipienttype'] = $type[$rq['recipienttype']];
     }
     // 验证发信规则
     $valid = $this->verify($rq);
     if (!$valid) {
         return ee(2);
     }
     $rq['sendtime'] = date("Y-m-d H:i:s");
     return parent::c($rq);
 }
Ejemplo n.º 2
0
 /**
  * 创建
  */
 public function c($rq = NULL)
 {
     $this->guarded = arr_except_vals($this->guarded, ['password']);
     if (!$rq) {
         $rq = rq();
     }
     return parent::c($rq);
 }
Ejemplo n.º 3
0
 /**
  * 创建
  */
 public function c($rq = null)
 {
     $this->guarded = arr_except_vals($this->guarded, ['password']);
     if (!$rq) {
         $rq = rq();
     }
     if (isset($rq['password'])) {
         $rq['password'] = hash_password($rq['password']);
     }
     return parent::c($rq);
 }
Ejemplo n.º 4
0
 public function c($rq = NULL, $rules = NULL, $messages = NULL)
 {
     $rq = rq();
     $new = parent::c($rq, $this->createRule);
     if ($new['status'] == 1) {
         // 设置
         $query = $this->where('robot_id', $rq['robot_id']);
         $query->update(['recent' => 0]);
         $query->where('id', $new['d']['id'])->update(['recent' => 1]);
     }
     $new['rq'] = $rq;
     return $new;
 }
Ejemplo n.º 5
0
 public function c($rq = NULL, $rules = NULL, $messages = NULL)
 {
     $rq = rqOnly(['action_type', 'memo', 'robot_id']);
     // 设置 id
     $rq['at'] = time();
     $rq['employee_id'] = Session::get('uid');
     if ($rq['action_type'] == 2) {
         // 更新状态
         IRobot::where('id', $rq['robot_id'])->update(['status' => 1]);
     } else {
         if ($rq['action_type'] == 3) {
             IRobot::where('id', $rq['robot_id'])->update(['status' => 2]);
         } else {
             if ($rq['action_type'] == 4) {
                 IRobot::where('id', $rq['robot_id'])->update(['status' => 0]);
             }
         }
     }
     return parent::c($rq);
 }