Пример #1
0
 /**
  * 为CURD提供关联数据
  */
 public function assignRelateData()
 {
     $this->location = province($this->province_id) . city($this->city_id);
     // $this->doctorNum        =   $this->doctor->count();
     // $this->departmentNum    =   $this->department->count();
     $this->agencyNum = $this->getAllAgency()->count();
     $this->deviceNum = $this->getCurrentDevice()->count();
 }
Пример #2
0
 /**
  * @param $mid       模型ID
  * @param $content   内容
  * @return array     处理完成,返回数组
  */
 public function parse($mid, $content)
 {
     if (empty($content)) {
         return array();
     }
     $fieldRes = $this->where('modelid', $mid)->query();
     $ncontent = array();
     foreach ($fieldRes as $field) {
         if ($field['formtype'] == 'pictures') {
             $content[$field['name']] = unserialize($content[$field['name']]);
         } elseif ($field['formtype'] == 'areaSelect') {
             $area = explode(',', $content[$field['name']]);
             $level = 0;
             $content[$field['name']] = array();
             foreach ($area as $id) {
                 if ($id != null) {
                     if ($level == 0) {
                         $content[$field['name']]['province'] = array('id' => $id, 'name' => province($id));
                     } elseif ($level == 1) {
                         $content[$field['name']]['city'] = array('id' => $id, 'name' => city($id));
                     } elseif ($level == 2) {
                         $content[$field['name']]['district'] = array('id' => $id, 'name' => district($id));
                     }
                 }
                 $level++;
             }
         } elseif ($field['formtype'] == 'tags') {
             //如果类型是tags则将此字段设置为数组
             $content[$field['name']] = explode(',', $content[$field['name']]);
         }
         //处理转义
         $ncontent[$field['name']] = $this->stripslashes($content[$field['name']]);
     }
     unset($content);
     return $ncontent;
 }
Пример #3
0
function cbProcess($r, $args)
{
    global $curl, $db, $dbCom, $rabbitmqObj;
    $db->clear();
    if ($r['info']['http_code'] == 200) {
        //        print_r($r);die();
        $res = json_decode($r['content'], true);
        if (isset($res['status']) && $res['status'] == 1) {
            $id = $args['id'];
            //            echo "detail:id:$id\r\n";
            $data = $res['data']['Company'];
            if (isset($data['Area'])) {
                $update = array('province_store' => $data['Area']['Province'], 'province' => province($data['Area']['Province']), 'city' => $data['Area']['City'], 'county' => $data['Area']['County']);
                $db->update('company', $update, array('id' => $id));
            }
            //如果注册号为空,添加上
            if (empty($comArr['reg_id']) || $comArr['reg_id'] == 1) {
                $db->update('company', array('reg_id' => $data['No']), array('id' => $id));
            }
            //更改状态
            $db->update('company', array('status' => 2, 'updatetime' => time()), array('id' => $id));
            //数据入库
            $cid = insert($data);
            if ($cid > 0) {
                //打入更新缓存队列
                $rabbitmqObj->set('combusiness', 'cbupdate', $cid, 'ssdb');
            }
        } else {
            print_r($res);
        }
    } else {
        print_r($r);
        //        echo 2, "\r\n";
    }
}