コード例 #1
0
 public function extrationdoedit()
 {
     $id = $_POST['id'];
     if (!getWantApply($id)) {
         $this->error('该配资已经申请停止操盘,请优先处理停止操盘申请!');
     }
     $counttrader = $_POST['counttrader'];
     $total_money = M('shares_apply')->getFieldByid($id, "total_money");
     $uid = M('shares_apply')->getFieldByid($id, "uid");
     $order = M('shares_apply')->getFieldByid($id, "order");
     if ($_POST['examiney'] == 2) {
         if ($counttrader < $total_money) {
             $this->error('HOMS总操盘金额小于所获配资总金额,无盈利,建议审核不通过!');
         } else {
             $extration = $counttrader - $total_money;
             $user_money = M('member_money')->where("uid = {$uid}")->find();
             $savemoney = array();
             $savemoney['account_money'] = $user_money['account_money'] + $extration;
             $ret = M('member_money')->where("uid = {$uid}")->save($savemoney);
             $status = array();
             $status['status'] = 2;
             $status['info'] = $this->_post("info");
             $tr = M('shares_apply')->where("id = {$id}")->save($status);
             if ($ret && $tr) {
                 $info = $order . "申请提取盈利成功,共" . $extration . '元';
                 if (pzmembermoneylod($extration, $uid, $info, $id, 51)) {
                     $this->success('处理成功!');
                     alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核通过操作成功!');
                 } else {
                     $this->error('处理失败!');
                     alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核通过操作失败!');
                 }
             } else {
                 $this->error('资金出错!');
             }
         }
     } elseif ($_POST['examiney'] == 4) {
         $status = array();
         $status['status'] = 2;
         $status['info'] = $this->_post("info");
         $tr = M('shares_apply')->where("id = {$id}")->save($status);
         if ($tr) {
             $cont = $order . "订单HOMS没有盈利";
             if (innermsg($uid, '申请提取盈利', $cont)) {
                 $this->success('处理成功!');
                 alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核不通过操作成功!');
             } else {
                 $this->error('处理失败!');
                 alogs("extrationdoedit", 0, 1, '管理员执行了' . $order . '号订单盈利提取审核不通过操作失败!');
             }
         } else {
             $this->error('数据有误!');
         }
     }
 }
コード例 #2
0
 public function getMeMonery()
 {
     $jsoncode = file_get_contents("php://input");
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['uid'])) {
         ajaxmsg("查询错误!", 0);
     }
     $ids = M('members_status')->getFieldByUid($this->uid, 'id_status');
     if ($ids != 1) {
         ajaxmsg('您还未完成身份验证,请先进行实名认证!', 0);
     }
     //判断是否手机认证
     $phones = M('members_status')->getFieldByUid($this->uid, 'phone_status');
     if ($phones != 1) {
         ajaxmsg('您还未手机认证,请先进行手机认证!', 0);
     }
     $res = get_cps_trader('shares_global');
     $data = array();
     $data['principal'] = $arr['memonery'];
     //用户的本金
     $data['type_id'] = 3;
     //类型id 3代表操盘手
     $data['uid'] = $_SESSION['u_id'];
     //申请人uid
     $data['lever_ratio'] = $res[2];
     //倍率
     $data['order'] = 'cps_' . time() . mt_rand(1000, 100000);
     //订单号
     $data['shares_money'] = $data['principal'] * $res[2];
     //配资金额
     $noticerate = $res[3] / 100;
     $closerate = $res[4] / 100;
     $data['open'] = $closerate * $data['principal'] + $data['shares_money'];
     //平仓线 = 平仓线比率*本金+操盘资金
     $data['alert'] = $noticerate * $data['principal'] + $data['shares_money'];
     //警戒线 = 平仓线比率*本金+操盘资金
     $data['open_ratio'] = $res[4];
     //平仓线比率
     $data['alert_ratio'] = $res[3];
     //警戒线比率
     $data['add_time'] = time();
     $data['ip_address'] = get_client_ip();
     //获取客户端ip
     $data['status'] = 1;
     //待审核
     $data['duration'] = $res[5];
     //交易天数
     $data['total_money'] = $data['principal'] + $data["shares_money"];
     //总操盘资金 = 用户本金+配资金额
     $data['trading_time'] = $arr['istoday'];
     //是否今天交易
     $data['u_name'] = $_SESSION['u_user_name'];
     //	查询用户余额 如果用户余额足以支付则提交申请,不足以支付的时候返回配资失败
     //用户id
     $id = $_SESSION['u_id'];
     $result = getBalance('member_money', "back_money,account_money", "uid={$id}");
     if ($result) {
         //查询成功
         $total_money = $result['back_money'] + $result['account_money'];
         //获取用户的余额
         if ($total_money - $data['principal'] >= 0) {
             //用户的余额足够支付保证金
             //扣除保证金
             $deduct = $result["back_money"] - $data['principal'];
             if ($deduct >= 0) {
                 $update['back_money'] = $deduct;
                 $umoney = M("member_money")->where("uid={$id}")->save($update);
                 if (!$umoney) {
                     echo '1';
                     exit;
                 } else {
                     //写入到日志
                     $ainfo = $data['order'] . '我是操盘手订单支付保证金';
                     $areturnlog = pzmembermoneylod($data['principal'], $data['uid'], $ainfo, '', 52);
                 }
             } else {
                 $update['account_money'] = $result['account_money'] - abs($deduct);
                 $umoney = M("member_money")->where("uid={$id}")->save($update);
                 if (!$umoney) {
                     //更新失败
                     echo '1';
                     exit;
                 } else {
                     $ainfo = $data['order'] . '我是操盘手订单支付保证金';
                     $areturnlog = pzmembermoneylod($data['principal'], $data['uid'], $ainfo, '', 52);
                 }
             }
             $addapply = M('shares_apply');
             $res = $addapply->add($data);
             if ($res) {
                 /*echo '0';	//成功
                 	 	exit;
                 		*/
                 ajaxmsg("成功");
             } else {
                 /*echo '1';	//失败
                 	 	exit;	
                 		*/
                 ajaxmsg("失败", 1);
             }
         } else {
             /*echo '2';	//余额不足
             		exit;
             		*/
             ajaxmsg("余额不足", 2);
         }
     } else {
         /*echo '1';
         		exit;
         		*/
         ajaxmsg("退出", 1);
     }
 }
コード例 #3
0
ファイル: Stock.php プロジェクト: caotieshuan/ishoutou
function extraction($buy_money, $interest, $id)
{
    $to = $buy_money + $interest;
    $savestatus = array();
    $savestatus['status'] = 3;
    $status = M('current_investor')->where("id = {$id}")->save($savestatus);
    if ($status) {
        $uid = M('current_investor')->getFieldByid($id, "invest_uid");
        $user_money = M("member_money")->find($uid);
        $savemoney = array();
        $savamoney['account_money'] = $user_money['account_money'] + $to;
        $ret = M('member_money')->where("uid = {$uid}")->save($savamoney);
        if ($ret) {
            $info = '活期理财提取本金+利息' . $to . '元。';
            $log = pzmembermoneylod($to, $uid, $info);
            if ($log) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
コード例 #4
0
 public function examiney()
 {
     $id = $_POST['id'];
     $duration = $_POST['duration'];
     $homsuser = $_POST['homsuser'];
     $homspassword = $_POST['homspassword'];
     $info = $_POST['info'];
     if (empty($_POST['examiney'])) {
         $this->error('审核状态不可为空!');
     } else {
         $examiney = $_POST['examiney'];
     }
     if ($_POST['examiney'] == 2) {
         //发送客户端账号密码
         $homsuser = M('homsuser')->where("status = 0 and uid = 0")->order("id DESC")->find();
         if ($homsuser) {
             $info = '您在手投网股票配资平台申请配资成功,您的HOMS账号为:' . $homsuser['homsuser'] . ',密码为:' . $homsuser['homspass'] . ',请妥善保管,不要泄露他人!【手投网】';
             $ret = sendsms($user['user_phone'], $info);
             if ($ret) {
                 $savedata = array();
                 $savedata['status'] = 1;
                 $savedata['uid'] = $user['id'];
                 M('homsuser')->where("id = {$homsuser['id']}")->save($savedata);
             }
         } else {
             $this->error("HOMS账号已经用完,请及时录入!");
         }
         $the_current = time();
         $date_the_current = date("Y-m-d", $the_current);
         $apply = array();
         $apply['client_user'] = $homsuser['homsuser'];
         $apply['client_pass'] = $homsuser['homspass'];
         $apply['status'] = $examiney;
         $apply['examine_time'] = $the_current;
         $apply['info'] = $info;
         // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
         $apply['endtime'] = getEndTime($duration, $the_current);
         $ret = M('shares_apply')->where("id = {$id}")->save($apply);
         if ($ret) {
             /* $applyfind = M('shares_apply')->where("id = {$id}")->find();
             			$vo = examinembermoney($applyfind['uid'],$applyfind['principal'],$applyfind['manage_fee'],$applyfind['order'],$applyfind['id']);
             			if($vo){ */
             alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作成功!');
             $this->success('审核成功!');
             //}
         } else {
             alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作失败!');
             $this->error('审核失败!');
         }
     } elseif ($_POST['examiney'] == 4) {
         //审核不通过退回本金
         $user_apply = M('shares_apply')->field("uid,principal")->where("id = {$id}")->find();
         $uid = $user_apply['uid'];
         $principal = $user_apply['principal'];
         $back_money = M('member_money')->field('back_money')->where("uid={$uid}")->find();
         $money['back_money'] = $back_money['back_money'] + $principal;
         //用户原有的余额+本金
         $updatem = M('member_money')->field('back_money')->where("uid={$uid}")->save($money);
         if ($updatem) {
             $apply = array();
             $apply['status'] = $examiney;
             $apply['examine_time'] = $the_current;
             $apply['info'] = $info;
             // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
             $apply['endtime'] = getEndTime($duration, $the_current);
             $ret = M('shares_apply')->where("id = {$id}")->save($apply);
             if ($ret) {
                 $ainfo = $order . '管理员审核未通过,退还保证金';
                 pzmembermoneylod($principal, $uid, $ainfo, $id, 52);
                 $info = '很遗憾,您在手投网申请股票配资未通过,原因为' . $info . '!【手投网】';
                 sendsms($user['user_phone'], $info);
                 alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作成功!');
                 $this->success('审核不通过操作成功!');
             } else {
                 alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作失败!');
                 $this->error('审核不通过操作失败!');
             }
         } else {
             $this->error('审核不通过操作失败!');
         }
     }
 }
コード例 #5
0
 public function getMeMonery()
 {
     /* //判断是否实名认证
     			$ids = M('members_status')->getFieldByUid($this->uid,'id_status');
     			if($ids!=1){
     				echo jsonmsg('<font style="color:#E74A4A;font-weight:bold;font-size:16px;margin-bottom:30px;">您还未完成身份验证,请先进行实名认证!</font>',0);exit;
     			} */
     //判断是否手机认证
     /*$phones = M('members_status')->getFieldByUid($this->uid,'phone_status');
     		if($phones!=1){
     			echo jsonmsg('<font style="color:#E74A4A;font-weight:bold;font-size:16px;margin-bottom:30px;">您还未手机认证,请先进行手机认证!</font>',1);exit;
     		}*/
     $res = M("shares_global")->where("code='cps_1'")->getField("text");
     if ($this->_post('memonery') < $res) {
         echo jsonmsg('<font style="color:#E74A4A;font-weight:bold;font-size:16px;margin-bottom:30px;">数据有误!</font>', 4);
         exit;
     }
     $res = get_cps_trader('shares_global');
     $data = array();
     $data['principal'] = $_POST['memonery'];
     //用户的本金
     $data['type_id'] = 3;
     //类型id 3代表操盘手
     $data['uid'] = $_SESSION['u_id'];
     //申请人uid
     $data['lever_ratio'] = $res[2];
     //倍率
     $data['order'] = 'cps_' . time() . mt_rand(1000, 100000);
     //订单号
     $data['shares_money'] = $data['principal'] * $res[2];
     //配资金额
     $noticerate = $res[3] / 100;
     $closerate = $res[4] / 100;
     $data['open'] = $closerate * $data['principal'] + $data['shares_money'];
     //平仓线 = 平仓线比率*本金+操盘资金
     $data['alert'] = $noticerate * $data['principal'] + $data['shares_money'];
     //警戒线 = 平仓线比率*本金+操盘资金
     $data['open_ratio'] = $res[4];
     //平仓线比率
     $data['alert_ratio'] = $res[3];
     //警戒线比率
     $data['add_time'] = time();
     $data['ip_address'] = get_client_ip();
     //获取客户端ip
     $data['status'] = 1;
     //待审核
     $data['duration'] = $res[5];
     //交易天数
     $data['total_money'] = $data['principal'] + $data["shares_money"];
     //总操盘资金 = 用户本金+配资金额
     $data['trading_time'] = $_POST['istoday'];
     //是否今天交易
     $data['u_name'] = $_SESSION['u_user_name'];
     /**
     				查询用户余额 如果用户余额足以支付则提交申请,不足以支付的时候返回配资失败
     */
     //用户id
     $id = $_SESSION['u_id'];
     $result = getBalance('member_money', "back_money,account_money", "uid={$id}");
     if ($result) {
         //查询成功
         $total_money = $result['back_money'] + $result['account_money'];
         //获取用户的余额
         if ($total_money - $data['principal'] >= 0) {
             //用户的余额足够支付保证金
             //扣除保证金
             $deduct = $result["back_money"] - $data['principal'];
             if ($deduct >= 0) {
                 $update['back_money'] = $deduct;
                 $umoney = M("member_money")->where("uid={$id}")->save($update);
                 if (!$umoney) {
                     echo '1';
                     exit;
                 } else {
                     //写入到日志
                     $ainfo = $data['order'] . '我是操盘手订单支付保证金';
                     $areturnlog = pzmembermoneylod($data['principal'], $data['uid'], $ainfo, '', 52);
                 }
             } else {
                 $update['account_money'] = $result['account_money'] - abs($deduct);
                 $umoney = M("member_money")->where("uid={$id}")->save($update);
                 if (!$umoney) {
                     //更新失败
                     echo '1';
                     exit;
                 } else {
                     $ainfo = $data['order'] . '我是操盘手订单支付保证金';
                     $areturnlog = pzmembermoneylod($data['principal'], $data['uid'], $ainfo, '', 52);
                 }
             }
             $addapply = M('shares_apply');
             $res = $addapply->add($data);
             if ($res) {
                 echo '0';
                 //成功
                 exit;
             } else {
                 echo '1';
                 //失败
                 exit;
             }
         } else {
             echo '2';
             //余额不足
             exit;
         }
     } else {
         echo '1';
         exit;
     }
 }