public function postdata()
 {
     $this->glob = get_global_setting();
     $user_money = M("member_money")->where("uid = {$this->uid}")->find();
     //判断是否满足免费体验资格
     $quota_map['status'] = array("not in", "1,4");
     $quota_map['uid'] = $this->uid;
     $quata_num = D("shares_apply")->where("(status not in(1,4) AND uid = {$this->uid}) OR (status = 1 AND type_id = 4 AND uid = {$this->uid})")->count();
     //$quata_num = D("shares_apply")->where(" uid = {$this->uid}")->count();
     //dump($quata_num);die;
     if ($quata_num != 0) {
         echo jsonmsg('很抱歉,您不具备免费体验配资资格!', 0);
         exit;
     }
     //当天范围
     $today_start = strtotime(date("Y-m-d 00:00:00", time()));
     $today_end = strtotime(date("Y-m-d 23:59:59", time()));
     $free_map = array();
     $free_map['type_id'] = 4;
     $free_map['status'] = array("in", "1,2,3");
     $free_map['add_time'] = array("between", array($today_start, $today_end));
     $free_num = D("shares_apply")->where($free_map)->count();
     //判断是否满足免费体验名额
     if ($free_num >= $this->glob['free_num']) {
         echo jsonmsg('今日免费体验名额已满,请明天再来!', 0);
         exit;
     }
     //判断用户是否登录
     if (session('u_id') == null) {
         echo jsonmsg('您还没有登录,请先登录!', 2);
         exit;
     }
     //判断是否实名认证
     /*$ids = M('members_status')->getFieldByUid($this->uid,'id_status');
     		if($ids!=1){
     			echo jsonmsg('您还未完成身份验证,请先进行实名认证!',2);exit;
     		}*/
     //判断是否手机认证
     /*$phones = M('members_status')->getFieldByUid($this->uid,'phone_status');
     		if($phones!=1){
     			echo jsonmsg('您还未手机认证,请先进行手机认证!',3);exit;
     		}*/
     $uid = $this->uid;
     $count = getMoneylimit($this->uid);
     $all_money = $count + 1;
     if ($all_money > $user_money['account_money'] + $user_money['back_money']) {
         echo jsonmsg('您的可用余额不足以支付您所有的配资申请费用,请等待审核完成或进行充值!', 4);
         exit;
     }
     //执行添加
     $_POST['uid'] = $this->uid;
     $ret = D("SharesApply")->addFreeStock();
     if ($ret) {
         echo jsonmsg('恭喜配资成功!', 1);
         exit;
     } else {
         echo jsonmsg('恭喜配资失败!', 0);
         exit;
     }
 }
예제 #2
0
 public function dosupply()
 {
     $user_money = M('member_money')->where("uid = {$this->uid}")->find();
     $count = getMoneylimit($this->uid);
     if ($count + $this->_post("money") > $user_money['back_money'] + $user_money['account_money']) {
         $msg = array();
         $msg['msg'] = '可用余额不足!Sorry!';
         echo json_encode($msg);
         die;
     }
     dosupply($this->_post("id"), $this->_post("money"), $this->uid, 1);
 }
예제 #3
0
 public function postdatab()
 {
     $jsoncode = file_get_contents("php://input");
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['uid'])) {
         ajaxmsg("查询错误!", 0);
     }
     $user_money = M("member_money")->where("uid = {$this->uid}")->find();
     $quota_map['status'] = array("not in", "1,4");
     $quota_map['uid'] = $this->uid;
     $quata_num = D("shares_apply")->where("(status not in(1,4) AND uid = {$this->uid}) OR (status = 1 AND type_id = 4 AND uid = {$this->uid})")->count();
     if ($quata_num != 0) {
         ajaxmsg('很抱歉,您不具备免费体验配资资格!', 0);
     }
     //当天范围
     $today_start = strtotime(date("Y-m-d 00:00:00", time()));
     $today_end = strtotime(date("Y-m-d 23:59:59", time()));
     $free_map = array();
     $free_map['status'] = 4;
     $free_map['add_time'] = array("between", array($today_start, $today_end));
     $free_num = D("shares_apply")->where($free_map)->count();
     //判断是否满足免费体验名额
     if ($free_num >= $this->glob['free_num']) {
         ajaxmsg('今日免费体验名额已满,请明天再来!', 0);
     }
     //判断用户是否登录
     if (session('u_id') == null) {
         ajaxmsg('您还没有登录,请先登录!', 2);
     }
     $uid = $this->uid;
     $count = getMoneylimit($this->uid);
     $all_money = $count + 1;
     if ($all_money > $user_money['account_money'] + $user_money['back_money']) {
         ajaxmsg('您的可用余额不足以支付您所有的配资申请费用,请等待审核完成或进行充值!', 4);
     }
     //执行添加
     $_POST['uid'] = $this->uid;
     $ret = D("SharesApply")->addFreeStock();
     if ($ret) {
         ajaxmsg('恭喜配资成功!', 1);
     } else {
         ajaxmsg('恭喜配资失败!', 0);
     }
 }
예제 #4
0
 public function postdata()
 {
     $days = intval($_POST['days']);
     $stock_money = $_POST['stock_money'];
     $type = $_POST['type'];
     $istoday = $_POST['istoday'];
     if (!$istoday) {
         echo jsonmsg('数据有误!', 0);
         exit;
     } elseif (!$type) {
         echo jsonmsg('数据有误!', 0);
         exit;
     } elseif ($days < 2 || $days > 30) {
         echo jsonmsg('配资天数有误!', 0);
         exit;
     } elseif ($stock_money < 1000) {
         echo jsonmsg('配资金额小于最小配资金额!', 0);
         exit;
     }
     $uid = $this->uid;
     $glo = M('shares_global')->field('text')->where("code = " . "'{$type}'")->find();
     $glos = explode('|', $glo['text']);
     $guarantee_money = $stock_money / $glos[0];
     //保证金
     $interest = $stock_money * ($glos[1] / 1000) * $days;
     //总利息
     $user_money = M('member_money')->where("uid = {$this->uid}")->find();
     $uid = $this->uid;
     $count = getMoneylimit($this->uid);
     $all_money = $count + $guarantee_money + $interest;
     if ($all_money > $user_money['account_money'] + $user_money['back_money']) {
         echo jsonmsg('您的可用余额不足以支付您所有的配资申请费用,请等待审核完成或进行充值!', 4);
         exit;
     }
     /*
      //判断是否实名认证
     $ids = M('members_status')->getFieldByUid($this->uid,'id_status');
     if($ids!=1){
     	echo jsonmsg('您还未完成身份验证,请先进行实名认证!',2);exit;
     } 
     //判断是否手机认证
     $phones = M('members_status')->getFieldByUid($this->uid,'phone_status');
     if($phones!=1){
     	echo jsonmsg('您还未手机认证,请先进行手机认证!',3);exit;
     }
     */
     $ret = stockmoney($days, $stock_money, $type, $istoday, $uid);
     if ($ret) {
         echo jsonmsg('恭喜配资成功!', 1);
     } else {
         echo jsonmsg('Sorry,配资失败!', 0);
     }
     //dump($daydata);die;
 }