示例#1
0
 public function postdata()
 {
     $jsoncode = file_get_contents("php://input");
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['uid'])) {
         ajaxmsg("查询错误!", 0);
     }
     $days = $arr['days'];
     $stock_money = $arr['stock_money'];
     $type = $arr['type'];
     $istoday = $arr['istoday'];
     $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();
     //判断是否实名认证
     $ids = M('members_status')->getFieldByUid($this->uid, 'id_status');
     if ($ids != 1) {
         ajaxmsg('您还未完成身份验证,请先进行实名认证!', 2);
     }
     //判断是否手机认证
     $phones = M('members_status')->getFieldByUid($this->uid, 'phone_status');
     if ($phones != 1) {
         ajaxmsg('您还未手机认证,请先进行手机认证!', 3);
     }
     $uid = $this->uid;
     $count = getMoneylimit($this->uid);
     $all_money = $count + $guarantee_money + $interest;
     if ($all_money > $user_money['account_money'] + $user_money['back_money']) {
         ajaxmsg('您的可用余额不足以支付您所有的配资申请费用,请等待审核完成或进行充值!', 4);
     }
     $ret = stockmoney($days, $stock_money, $type, $istoday, $uid);
     //var_dump($ret);die;
     if ($ret) {
         ajaxmsg('恭喜配资成功!');
     } else {
         ajaxmsg("配资失败");
     }
 }
 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;
 }