120], [['contacts_phone', 'contacts_ID'], 'string', 'max' => 20], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'order_id' => 'Order ID', 'contacts_name' => 'Contacts Name', 'contacts_phone' => 'Contacts Phone', 'contacts_ID' => 'Contacts ID', 'contacts_type' => 'Contacts Type', 'update_time' => 'Update Time', 'create_time' => 'Create Time', 'delete_flag' => 'Delete Flag', 'bus_run_id' => 'Bus Run ID', ]; } /** * Function Description:插入联系人表 * Function Name: insertContacts * @param $param_arr * @param $orderId * * @return bool * * @author 娄梦宁 */ public function insertContacts($param_arr, $orderId) { $values = [ 'order_id' => $orderId, 'contacts_name' => $param_arr['contacts_name'], 'contacts_phone' => $param_arr['contacts_phone'], 'contacts_ID' => empty($param_arr['contacts_ID']) ? '' : $param_arr['contacts_ID'], 'bus_run_id' => empty($param_arr['run_id']) ? 0 : $param_arr['run_id'], 'create_time' => date('Y-m-d H:i:s'), ]; $this->attributes = $values; $res = $this->insert(); if (!$res) { return false; } return true; } /** * Des:获取订单拓展信息 * Name: getRowByOrderId * @param $orderId * @return array * @author 倪宗锋 */ public function getRowByOrderId($orderId) { $where = ['and']; $where[] = ['=', 'order_id', $orderId]; $where[] = ['=', 'contacts_type', 1]; $return = $this->find()->select(['contacts_name', 'contacts_phone', 'contacts_ID', 'contacts_type', 'bus_run_id', 'order_id']) ->from(static::tableName()) ->where($where) ->asArray(true) ->one(); return $return; } /** * Des:获取保险数量 * Name: getInsurance * @param $orderId * @return int * @author 倪宗锋 */ public function getInsuranceCnt($orderId) { $where = ['and']; $where[] = ['=', 'order_id', $orderId]; $where[] = ['=', 'contacts_type', 2]; $return = $this->find()->select(['contacts_name', 'contacts_phone', 'contacts_ID', 'contacts_type', 'bus_run_id', 'order_id']) ->from(static::tableName()) ->where($where) ->asArray(true) ->count(); return $return; } }