Commit b38806b1 authored by hujun's avatar hujun

容联云号码绑定修改

parent d93c3844
...@@ -163,6 +163,7 @@ class CallPhoneService ...@@ -163,6 +163,7 @@ class CallPhoneService
$result['phone'] = $call_phone['phone']; $result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
$type = 'AliYunBindAxb'; $type = 'AliYunBindAxb';
$bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release);
} else { } else {
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
} }
...@@ -174,15 +175,15 @@ class CallPhoneService ...@@ -174,15 +175,15 @@ class CallPhoneService
$result['phone'] = $call_phone['phone']; $result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
$type = 'YunTongXunBindAxb'; $type = 'YunTongXunBindAxb';
$bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release);
$bind->commit();
} else { } else {
$bind->rollback();
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
} }
} }
if ($result['status'] == 'success') {
$bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release);
}
Log::write(json_encode($result), $type); //记录日志 Log::write(json_encode($result), $type); //记录日志
} catch (\Exception $e) { } catch (\Exception $e) {
$data['status'] = 'failed'; $data['status'] = 'failed';
...@@ -320,6 +321,7 @@ class CallPhoneService ...@@ -320,6 +321,7 @@ class CallPhoneService
* 容联云号码绑定 * 容联云号码绑定
* *
* @return mixed * @return mixed
* @throws \think\exception\PDOException
*/ */
public function yunTongXun() public function yunTongXun()
{ {
......
...@@ -68,6 +68,7 @@ class AliYunPhone extends BaseModel ...@@ -68,6 +68,7 @@ class AliYunPhone extends BaseModel
* @param array $phone_x * @param array $phone_x
* @param $city * @param $city
* @return mixed * @return mixed
* @throws \think\exception\PDOException
*/ */
public function getAliYunPhoneAll($phone_a, $phone_b, $type = 1, $phone_x = [], $city) public function getAliYunPhoneAll($phone_a, $phone_b, $type = 1, $phone_x = [], $city)
{ {
...@@ -92,18 +93,19 @@ class AliYunPhone extends BaseModel ...@@ -92,18 +93,19 @@ class AliYunPhone extends BaseModel
$where_bind_a['b.phone_x'] = [ 'NOT IN', $phone_x]; $where_bind_a['b.phone_x'] = [ 'NOT IN', $phone_x];
$where_bind_b['b.phone_x'] = [ 'NOT IN', $phone_x]; $where_bind_b['b.phone_x'] = [ 'NOT IN', $phone_x];
} }
try {
$this->startTrans();
//找到与phone_a绑定的隐私号码 //找到与phone_a绑定的隐私号码
$where_bind_a['a.phone_a'] = $phone_a; $where_bind_a['a.phone_a'] = $phone_a;
$where_bind_a['a.status'] = 1; $where_bind_a['a.status'] = 1;
$where_bind_a['b.type'] = $type; $where_bind_a['b.type'] = $type;
$id_arr_a = $m_bind->getBindingPhoneList('b.id', $where_bind_a); $id_arr_a = $m_bind->getBindingPhoneList('b.id', $where_bind_a, true);
//找到phone_b绑定的隐私号码 //找到phone_b绑定的隐私号码
$where_bind_b['a.phone_b'] = $phone_b; $where_bind_b['a.phone_b'] = $phone_b;
$where_bind_b['a.status'] = 1; $where_bind_b['a.status'] = 1;
$where_bind_b['b.type'] = $type; $where_bind_b['b.type'] = $type;
$id_arr_b = $m_bind->getBindingPhoneList('b.id', $where_bind_b); $id_arr_b = $m_bind->getBindingPhoneList('b.id', $where_bind_b, true);
$id_merge = array_merge($id_arr_a['data'], $id_arr_b['data']); $id_merge = array_merge($id_arr_a['data'], $id_arr_b['data']);
...@@ -116,7 +118,6 @@ class AliYunPhone extends BaseModel ...@@ -116,7 +118,6 @@ class AliYunPhone extends BaseModel
$where_phone['type'] = $type; $where_phone['type'] = $type;
$where_phone['bind_num'] = ['<', 201]; $where_phone['bind_num'] = ['<', 201];
try {
if (empty($id)) { if (empty($id)) {
$result['data'] = $this->field('id,phone_x,area')->where($where_phone)->find(); $result['data'] = $this->field('id,phone_x,area')->where($where_phone)->find();
} else { } else {
...@@ -125,6 +126,7 @@ class AliYunPhone extends BaseModel ...@@ -125,6 +126,7 @@ class AliYunPhone extends BaseModel
} }
$result['status'] = 'successful'; $result['status'] = 'successful';
} catch (\Exception $e) { } catch (\Exception $e) {
$this->commit();
$result['status'] = 'fail'; $result['status'] = 'fail';
$result['msg'] = $e->getMessage(); $result['msg'] = $e->getMessage();
} }
......
...@@ -112,15 +112,17 @@ class BindingPhone extends BaseModel ...@@ -112,15 +112,17 @@ class BindingPhone extends BaseModel
* *
* @param $field * @param $field
* @param $where * @param $where
* @param bool $is_lock
* @return mixed * @return mixed
*/ */
public function getBindingPhoneList($field, $where) public function getBindingPhoneList($field, $where, $is_lock = false)
{ {
$data['data'] = []; $data['data'] = [];
try { try {
$data['data'] = $this->field($field)->alias('a') $data['data'] = $this->field($field)->alias('a')
->join('aliYun_phone b', 'a.aliYun_phone_id = b.id', 'left') ->join('aliYun_phone b', 'a.aliYun_phone_id = b.id', 'left')
->where($where) ->where($where)
->lock($is_lock)
->select(); ->select();
$data['status'] = 'successful'; $data['status'] = 'successful';
} catch (\Exception $e) { } catch (\Exception $e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment