public function promotion()
 {
     //自动生成推广码
     $expand_num = getExpandCode($this->uid);
     $this->assign("expand_num", $expand_num);
     $_P_fee = get_global_setting();
     $this->assign("reward", $_P_fee);
     $active = active_flag(2);
     $this->assign("active", $active);
     $data['html'] = $this->fetch();
     exit(json_encode($data));
 }
Beispiel #2
0
 public function regaction()
 {
     //判断推广码
     $expand_num = text($_POST['txtExpandNum']);
     if (!empty($expand_num)) {
         $expand_user = D('members')->where(array('expand_num' => $expand_num))->find();
         if (empty($expand_user)) {
             ajaxmsg('对不起,该推广码不存在', 0);
         }
     }
     $data['user_name'] = text($_POST['txtUser']);
     $data['user_pass'] = md5($_POST['txtPwd']);
     $data['user_email'] = text($_POST['txtEmail']);
     $count = M('members')->where("user_email = '{$data['user_email']}' OR user_name='{$data['user_name']}'")->count('id');
     if ($count > 0) {
         ajaxmsg("注册失败,用户名或者邮件已经有人使用", 0);
     }
     //uc注册
     $loginconfig = FS("Webconfig/loginconfig");
     $uc_mcfg = $loginconfig['uc'];
     if ($uc_mcfg['enable'] == 1) {
         require_once C('APP_ROOT') . "Lib/Uc/config.inc.php";
         require C('APP_ROOT') . "Lib/Uc/uc_client/client.php";
         $uid = uc_user_register($data['user_name'], $_POST['txtPwd'], $data['user_email']);
         if ($uid <= 0) {
             if ($uid == -1) {
                 ajaxmsg('用户名不合法', 0);
             } elseif ($uid == -2) {
                 ajaxmsg('包含要允许注册的词语', 0);
             } elseif ($uid == -3) {
                 ajaxmsg('用户名已经存在', 0);
             } elseif ($uid == -4) {
                 ajaxmsg('Email 格式有误', 0);
             } elseif ($uid == -5) {
                 ajaxmsg('Email 不允许注册', 0);
             } elseif ($uid == -6) {
                 ajaxmsg('该 Email 已经被注册', 0);
             } else {
                 ajaxmsg('未定义', 0);
             }
         }
     }
     //uc注册
     $data['reg_time'] = time();
     $data['reg_ip'] = get_client_ip();
     $data['lastlog_time'] = time();
     $data['lastlog_ip'] = get_client_ip();
     if (!empty($expand_num)) {
         $data['recommend_id'] = $expand_user['id'];
     }
     $newid = M('members')->add($data);
     if ($newid) {
         session('u_id', $newid);
         session('u_user_name', $data['user_name']);
         session("invite_mem", null);
         //memberMoneyLog($newid,1,$this->glo['award_reg'],"注册奖励");
         Notice(1, $newid, array('email', $data['user_email']));
         //注册送奖励
         $active = active_flag(1);
         if ($active['flag'] == 1) {
             active_award($newid, 0, $active['amount'], "注册活动奖励", "您好,感谢你注册银通泰会员,您已获得" . $active['amount'] . "元现金。");
         }
         ajaxmsg();
     } else {
         ajaxmsg("注册失败,请重试", 0);
     }
 }
Beispiel #3
0
    public function doEditWaitverify2()
    {
        //复审的时候这些信息不允许更改
        unset($_POST["repayment_type"]);
        unset($_POST["borrow_money"]);
        unset($_POST["borrow_interest_rate"]);
        unset($_POST["borrow_duration"]);
        unset($_POST["reward_type"]);
        unset($_POST["can_auto"]);
        unset($_POST["is_tuijian"]);
        unset($_POST["borrow_type"]);
        unset($_POST["borrow_fee"]);
        unset($_POST["collect_day"]);
        unset($_POST["borrow_max"]);
        $m = D(ucfirst($this->getActionName()));
        if (false === $m->create()) {
            $this->error($m->getError());
        }
        $vm = M('borrow_info')->alias("bi")->field('borrow_uid,borrow_status,borrow_type,first_verify_time,password,updata,borrow_name,borrow_money,borrow_interest_rate,repayment_type,borrow_duration,
				borrow_info,pro_provide,can_auto,is_tuijian,borrow_fee,collect_day,borrow_max,bv.deal_info_2')->join("left join {$this->pre}borrow_verify bv on bi.id=bv.borrow_id")->where(array("bi.id" => $m->id))->find();
        if ($m->borrow_status != 5 && $m->borrow_status != 6) {
            $this->error('已经满标的的借款只能改为复审通过或者复审未通过');
        }
        if ($vm["borrow_status"] == 5 || $vm["borrow_status"] == 6) {
            $this->error('已复审过的标不能再次复审');
        }
        ////////////////////图片编辑///////////////////////
        foreach ($_POST['swfimglist'] as $key => $v) {
            $row[$key]['img'] = substr($v, 1);
            $row[$key]['info'] = $_POST['picinfo'][$key];
        }
        $m->updata = serialize($row);
        ////////////////////图片编辑///////////////////////
        if ($m->borrow_status == 6) {
            //复审通过
            $appid = borrowApproved($m->id);
            if (!$appid) {
                $this->error("复审失败");
            }
            //新标提醒
            //newTip($m->id);MTip
            MTip('chk9', $vm['borrow_uid'], $m->id);
            //自动投标
            $vss = M("members")->field("user_phone,user_name")->where("id = {$vm['borrow_uid']}")->find();
            SMStip("approve", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $m->id), $m->id, array($vm['borrow_uid']));
            //autoInvest($result);
        } elseif ($m->borrow_status == 5) {
            //复审未通过
            $appid = borrowRefuse($m->id, 3);
            if (!$appid) {
                $this->error("复审失败");
            }
            MTip('chk12', $vm['borrow_uid'], $m->id);
        }
        //保存当前数据对象
        $m->second_verify_time = time();
        unset($m->borrow_uid);
        $bs = intval($_POST['borrow_status']);
        $m->total = $m->repayment_type == 1 ? 1 : $vm['borrow_duration'];
        if ($result = $m->save()) {
            // 保存成功
            $verify_info['borrow_id'] = intval($_POST['id']);
            $verify_info['deal_info_2'] = text($_POST['deal_info_2']);
            $verify_info['deal_user_2'] = $this->admin_id;
            $verify_info['deal_time_2'] = time();
            $verify_info['deal_status_2'] = $bs;
            if ($vm['first_verify_time'] > 0) {
                M('borrow_verify')->save($verify_info);
            } else {
                M('borrow_verify')->add($verify_info);
            }
            // 日志记录
            unset($vm["repayment_type"]);
            unset($vm["borrow_money"]);
            unset($vm["borrow_interest_rate"]);
            unset($vm["borrow_duration"]);
            unset($vm["reward_type"]);
            unset($vm["reward_num"]);
            unset($vm["can_auto"]);
            unset($vm["is_tuijian"]);
            unset($vm["borrow_type"]);
            unset($vm["borrow_fee"]);
            unset($vm["collect_day"]);
            unset($vm["borrow_max"]);
            saveDataLog($_POST['id'], $vm, $_POST, C('BORROW_LOG_KEY'), session('adminname'), $this->admin_id, $this->logOpType["BORROW_OPT"][0]);
            //首投活动
            $active = active_flag(2);
            //首投推荐人活动
            $active_recommend = active_flag(3);
            if ($active['flag'] == 1 || $active_recommend['flag'] == 1) {
                $active_sql = ' select a.investor_uid,sum(a.investor_capital) as sumAmount ';
                $active_sql .= ' from ' . C('DB_PREFIX') . 'borrow_investor a ';
                $active_sql .= ' where a.borrow_id=' . $_POST['id'];
                $active_sql .= ' and a.investor_uid not in (select b.investor_uid from ' . C('DB_PREFIX') . 'borrow_investor b where b.borrow_id != ' . $_POST['id'] . ') ';
                $active_sql .= ' GROUP BY a.investor_uid ';
                $Model = M();
                Log::write($active_sql, Log::ERR, Log::FILE, 'test111.log', $extra = '');
                $uids = $Model->query($active_sql);
            }
            if ($active['flag'] == 1) {
                foreach ($uids as $ukey => $uvalue) {
                    //首投1000送奖励
                    if ($uvalue['sumAmount'] >= $active['invest_amount']) {
                        active_award($uvalue['investor_uid'], 1, $active['amount'], "首投活动奖励", "您好,您在银通泰首投" . $uvalue['sumAmount'] . "元,您已获得" . $active['amount'] . "元现金奖励。");
                    }
                }
            }
            //首投有推荐人送奖励
            if ($active_recommend['flag'] == 1) {
                foreach ($uids as $ukey => $uvalue) {
                    $member_investor = M('members')->where("id = {$uvalue['investor_uid']}")->find();
                    if ($member_investor['recommend_id']) {
                        active_award($member_investor['recommend_id'], 2, $active_recommend['amount'], "推荐活动奖励", "您好,您已成功推荐一个好友在银通泰投资,您已获得" . $active_recommend['amount'] . "元现金奖励。");
                    }
                }
            }
            // 成功提示
            $this->assign('jumpUrl', __URL__ . "/" . session('listaction'));
            $this->success(L('修改成功'));
        } else {
            // 失败提示
            $this->error(L('修改失败'));
        }
    }