Commit 2ca2a78b authored by hujun's avatar hujun

尝试5次绑定

parent ae55beb8
......@@ -83,8 +83,25 @@ class CellPhone extends Basic
$this->msg = '绑定成功。';
$this->data = ['phone' => $phone_x['phone_x']];
} else {
$this->code = 101;
$this->msg = '号码绑定冲突,请联系运营人员!';
//尝试5次绑定
for ($i = 1; $i < 5; $i++) {
$phone_x = $aliYunPhone->getAliYunPhone($phone_a, $phone_b, $setting['is_privacy'], $phone_x);
$result = PlsDemo::bindAxb($phone_a, $phone_b, $time, $record, $phone_x); //再尝试一下
if ($result->Message == 'OK') {
$aliYunPhone->editStatus($phone_x, $phone_a, $phone_b, $record, $time, $result,'',$setting['is_privacy']); //记录绑定
$this->msg = '绑定成功。';
$this->data = ['phone' => $phone_x['phone_x']];
break;
} else {
$phone_x_array[] = $phone_x; //记录绑定冲突号码,重新分配
}
}
if ($result->Message != 'OK') {
$this->code = 101;
$this->msg = '号码绑定冲突,请联系运营人员!';
}
}
}else {
/*容联云*/
......
......@@ -20,19 +20,24 @@ class AliYunPhone extends BaseModel
*
* @param $phone_a
* @param $phone_b
* @param $type
* @param int $type
* @param array $phone_x
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAliYunPhone($phone_a, $phone_b, $type = 1) {
public function getAliYunPhone($phone_a, $phone_b, $type = 1, array $phone_x = []) {
//找到phone_a和phone_b出现在两个字段中
$where_bind[] = ['EXP', "(a.phone_a='{$phone_a}' or a.phone_b='{$phone_a}') or (a.phone_a='{$phone_b}' or a.phone_b='{$phone_b}')"];
$where_bind['a.status'] = 1;
$where_bind['b.bind_num'] = ['<=',200];
$where_bind['b.type'] = $type;
if (!empty($phone_x)) {
$where_bind['b.phone_x'] = ['NOT IN', implode(',', $phone_x)];
}
$m_bind = new BindingPhone();
$id_arr = $m_bind->getBindingPhoneList('b.id', $where_bind);
......
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