/**
  * 格式化成API所需要的样式
  *
  * @return array
  */
 public function formatToApi()
 {
     $return_arr = array("id" => $this->id, "type" => $this->type, "url" => $this->url, "content" => $this->content, "is_readed" => $this->is_readed, "created_at" => apiTime($this->created_at));
     if ($this->type != self::SYSTEM) {
         $return_arr['user'] = $this->user->simpleFormatToApi();
         $return_arr['order_id'] = $this->order_id;
     }
     return $return_arr;
 }
Exemple #2
0
 /**
  * 格式化API格式
  *
  * @return array
  */
 public function formatToApi()
 {
     return array('id' => $this->id, 'user' => $this->sendUser->simpleFormatToApi(), 'rank' => $this->rank, 'content' => array('text' => $this->content), 'created_at' => apiTime($this->created_at));
 }
Exemple #3
0
 /**
  * 获取API格式数据  
  *
  * @return array
  */
 public function formatToApi()
 {
     if ($this->employee) {
         $employeeInfo = $this->employeeInfo->simpleFormatToApi();
     } else {
         $employeeInfo = NULL;
     }
     if ($this->employer) {
         $employerInfo = $this->employerInfo->simpleFormatToApi();
     } else {
         $employerInfo = NULL;
     }
     $path = 'http://' . $_SERVER['HTTP_HOST'];
     if (!empty($this->voice)) {
         $voice = getFilePath($this->voice, 'voice');
     } else {
         $voice = $this->voice;
     }
     $employerComment = $this->employerComment($this->employer, $this->id);
     $employeeComment = $this->employeeComment($this->employee, $this->id);
     // print_r($employerComment);exit;
     // 雇主的评论
     if ($employerComment) {
         $this->ercomment_id = $employerComment->id;
         $employer_comment = $this->ercommentInfo->formatToApi();
     } else {
         $employer_comment = NULL;
     }
     // 雇员的评论
     if ($employeeComment) {
         $this->eecomment_id = $employeeComment->id;
         $employee_comment = $this->eecommentInfo->formatToApi();
     } else {
         $employee_comment = NULL;
     }
     if ($this->serviceInfo) {
         $service_type = $this->serviceInfo->formatToApi();
     } else {
         $service_type = NULL;
     }
     return array('id' => $this->id, 'order_sn' => $this->order_sn, 'order_status' => $this->order_status, 'pay_code' => $this->pay_code, 'employer' => $employerInfo, "employee" => $employeeInfo, 'offer_price' => $this->offer_price, 'appointment_time' => $this->appointment_time, 'transaction_price' => $this->transaction_price, 'service_type' => $service_type, 'location' => apiLocation($this->location), 'to' => apiLocation($this->to), 'rank' => $this->rank, 'accept_time' => apiTime($this->accept_time), 'push_number' => $this->push_number, 'duration' => $this->duration, 'content' => array('text' => $this->text, 'voice' => $voice), 'employer_comment' => $employer_comment, 'employee_comment' => $employee_comment, 'created_at' => apiTime($this->created_at));
     // return $this->user;
 }
 /**
  * 获取API格式数据  
  *
  * @return array
  */
 public function formatToApi()
 {
     return array('id' => $this->id, 'amount' => $this->amount, 'state' => $this->state, 'created_at' => apiTime($this->created_at));
 }
Exemple #5
0
 /**
  * 简单用户格式化API格式
  *
  * @return array
  */
 public function simpleFormatToApi()
 {
     return array('id' => $this->id, 'user_group' => $this->role, 'nickname' => $this->nickname, 'mobile_phone' => $this->mobile, 'gender' => $this->gender, "avatar" => array("width" => 0, "height" => 0, "thumb" => $this->avatar(), "large" => $this->avatar()), "comment_goodrate" => $this->comment_goodrate, "comment_count" => $this->comment_count, "current_service_price" => $this->price, "location" => json_decode($this->location), "joined_at" => apiTime($this->created_at));
 }
 /**
  * 获取API格式数据  
  *
  * @return array
  */
 public function formatToApi()
 {
     // 每次都返回全部的历史状态 排序 并 标注
     return array('id' => $this->id, 'user' => $this->user->simpleFormatToApi(), 'order_action' => $this->order_status, 'active' => $this->active, 'note' => $this->note, 'created_at' => apiTime($this->created_at));
     // return $this->user;
 }