public function doEditWaitverify() { $m = D(ucfirst($this->getActionName())); if (false === $m->create()) { $this->error($m->getError()); } $vm = M('borrow_info')->field('id,borrow_name,reward_num,borrow_money,capital_name,borrow_duration,repayment_type,borrow_interest_rate,borrow_uid,borrow_status,borrow_type,first_verify_time,password,updata,danbao,vouch_money,money_collect,can_auto')->find($m->id); $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) { $this->error("提交的借款利率不在允许范围,请重试", 0); exit; } if ($m->repayment_type == '1' && ($m->borrow_duration > $borrow_duration_day[1] || $m->borrow_duration < $borrow_duration_day[0])) { $this->error("提交的借款期限不在允许范围,请去网站设置处重新设置系统参数", 0); exit; } if ($m->repayment_type != '1' && ($m->borrow_duration > $borrow_duration[1] || $m->borrow_duration < $borrow_duration[0])) { $this->error("提交的借款期限不在允许范围,请去网站设置处重新设置系统参数", 0); exit; } ////////////////////图片编辑/////////////////////// if (!empty($_POST['swfimglist'])) { foreach ($_POST['swfimglist'] as $key => $v) { $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $m->updata = serialize($row); } ////////////////////图片编辑/////////////////////// if ($vm['borrow_status'] != 2 && $m->borrow_status == 2) { //新标提醒 //newTip($m->id); MTip('chk8', $vm['borrow_uid'], $m->id); //自动投标 if ($m->borrow_type == 1) { memberLimitLog($vm['borrow_uid'], 1, -$m->borrow_money, $info = "{$m->id}号标初审通过"); } elseif ($m->borrow_type == 2) { memberLimitLog($vm['borrow_uid'], 2, -$m->borrow_money, $info = "{$m->id}号标初审通过"); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find(); SMStip("firstV", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id)); } //if($m->borrow_status==2) $m->collect_time = strtotime("+ {$m->collect_day} days"); if ($m->borrow_status == 2) { $m->collect_time = strtotime("+ {$m->collect_day} days"); $m->reward_num = $_POST['reward_num']; //$m->is_tuijian = 1; } $m->money_invest_place = intval($_POST['money_invest_place']); $m->borrow_interest = getBorrowInterest($m->repayment_type, $m->borrow_money, $m->borrow_duration, $m->borrow_interest_rate); //保存当前数据对象 if ($m->borrow_status == 2 || $m->borrow_status == 1) { $m->first_verify_time = time(); } else { unset($m->first_verify_time); } unset($m->borrow_uid); $bs = intval($_POST['borrow_status']); //新加接口数据准备 $toId = M('member_to')->where(array('username' => array('like', $vm['capital_name'])))->getField('id'); if (empty($toId)) { $toId = M('member_to')->add(array('username' => $vm['capital_name'])); } //按天到期还款、一次性还款 4 //按月分期还款 3 //每月还息到期还本 1 $lilv = array(1 => 4, 5 => 4, 2 => 3, 4 => 1); $yottarr = array('subject_id' => $m->id, 'is_test' => '0', 'type' => 0, 'name' => $m->borrow_name, 'borrow_type' => '1', 'desc' => $m->borrow_info, 'reward' => $vm['reward_num'], 'reward_type' => '1', 'url' => MU("Home/invest", "invest", array("id" => $m->id, "suffix" => C("URL_HTML_SUFFIX")), true), 'borrow_username' => $toId, 'account' => $m->borrow_money, 'period' => $m->borrow_duration, 'period_type' => 1 == $m->repayment_type ? 1 : 0, 'apr' => $m->borrow_interest_rate, 'repay_style' => $lilv[$m->repayment_type], 'status' => '2', 'addtime' => time()); //结束新加 if ($result = $m->save()) { //保存成功 if (2 == $bs && $this->yott()) { $yott = new yott(); $res = json_decode($yott->createP2p($yottarr)); //记录日志 M('yott_log')->add(array('dateline' => time(), 'apitype' => 'createp2p', 'apidata' => json_encode($yottarr), 'code' => $res->code, 'msg' => $res->msg)); } if ($bs == 2 || $bs == 1) { $verify_info['borrow_id'] = intval($_POST['id']); $verify_info['deal_info'] = text($_POST['deal_info']); $verify_info['deal_user'] = $this->admin_id; $verify_info['deal_time'] = time(); $verify_info['deal_status'] = $bs; if ($vm['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } } if ($vm['borrow_status'] != 2 && $_POST['borrow_status'] == 2 && $vm['can_auto'] == 1 && empty($vm['password']) == true) { if ($vm['borrow_type'] != 3) { autoInvest(intval($_POST['id'])); } } //if($vm['borrow_status']<>2 && $_POST['borrow_status']==2)) autoInvest(intval($_POST['id'])); alogs("doEditWait", $result, 1, '初审操作成功!'); //管理员操作日志 //成功提示 $this->assign('jumpUrl', __URL__ . "/" . session('listaction')); $this->success(L('修改成功')); } else { alogs("doEditWait", $result, 0, '初审操作失败!'); //管理员操作日志 //失败提示 $this->error(L('修改失败')); } }