public function getrate() { $datag = get_global_setting(); $this->assign("glo", $datag); $month = $this->_get("term"); $pzje = $this->_get("lever"); echo getrateratio($month, $pzje); //dump(getrateratio($month,$pzje);); }
public function addMonthStock() { $this->create(); $lever = D("SharesLever")->getById($this->lever_id); $this->type_id = 2; //类型 2为月月赢盈 $this->lever_ratio = $lever['lever_ratio']; //杠杆比率 $this->shares_money = $this->principal * $this->lever_ratio; //所获配资金 $this->manage_rate = getrateratio($this->duration, $this->lever_ratio); //管理费比率 $this->manage_fee = $this->manage_rate / 100 * $this->shares_money * $this->duration; //总管理费 $this->one_manage_fee = $this->manage_rate / 100 * $this->shares_money; //单次管理费 $this->order = "MPZ" . rand(1, 999) . time(); //订单号 $this->open = $this->principal * $lever['open_ratio'] / 100 * $this->lever_ratio + $this->shares_money; //平仓线 $this->alert = $this->principal * $lever['alert_ratio'] / 100 * $this->lever_ratio + $this->shares_money; //警戒线 $this->open_ratio = $lever['open_ratio']; //平仓线比率 $this->alert_ratio = $lever['alert_ratio']; //警戒线比率 $this->add_time = time(); //申请时间 $this->ip_address = get_client_ip(); //申请ip $this->status = 1; //状态 $this->recovery_time = time(); //回收时间 $this->already_manage_fee = $this->manage_rate / 100 * $this->shares_money; //已收管理费 $this->total_money = $this->principal + $this->shares_money; //交易总金额 $this->stock_admin_id = getAdminidByInvitation(session('invitation_code')); $this->u_name = session("u_user_name"); //申请用户名 return $this->add(); /* $ress=$this->add(); dump(M()->getlastsql());die; */ }
function monthAdditional($id, $money) { //配资id 追加配资金额 $apply = M("shares_apply")->find($id); $all_shares_money = $apply['shares_money'] + $money; $apply_manage_fee = $apply['manage_fee'] / $apply['duration']; $manage_rate = getrateratio($apply['duration'], $all_shares_money); $manage_fee = $manage_rate / 100 * $all_shares_money - $apply_manage_fee; //追加所产生的管理费 $add_principal = $money / $apply['lever_ratio']; //追加所产生的本金 //查询余额是否充足 $member_money = M('member_money')->where("uid = {$apply['uid']}")->find(); if ($manage_fee + $add_principal > $member_money['account_money'] + $member_money['back_money']) { echo jsonmsg('可用余额不足,请充值!', 0); die; } $savedata = array(); $savedata['principal'] = $add_principal; $savedata['shares_money'] = $money; $savedata['status'] = 1; $savedata['add_time'] = time(); $savedata['manage_fee'] = $manage_fee; $savedata['manage_rate'] = $manage_rate; $savedata['shares_id'] = $id; $savedata['u_name'] = $apply['u_name']; $savedata['order'] = $apply['order']; $savedata['duration'] = $apply['already_manage_fee'] / $apply_manage_fee; $savedata['type_id'] = 2; $ret = M("shares_additional")->add($savedata); if ($ret) { echo jsonmsg('追加申请成功,请等待审核!', 1); } else { echo jsonmsg('追加申请失败!', 0); } }
public function getrate() { $month = $this->_get("term"); $pzje = $this->_get("pzje"); echo getrateratio($month, $pzje); }