public static function heart(){
$heart=new Heart();
$heart->heart();
return;
}
public function precautious_line(){
if(!yan_time($last_time=15.1)){
Log::write('非交易时间');
return;
}
$borrow_arr = Db::name('stock_borrow')->where('status','1')->select();
if(!empty($borrow_arr)){
foreach ($borrow_arr as $key=>$val){
$position_stock_arr = Db::name('stock_position')->where('sub_id',$val['stock_subaccount_id'])->field('gupiao_code,stock_count')->select();
$market_val= '';
if(!empty($position_stock_arr)){
foreach ($position_stock_arr as $value){
$current_price = z_market($value['gupiao_code'])['current_price']; //股票实时价格
$market_val += $value['stock_count']*$current_price; //最新市值
}
}else{
continue;
//echo "此配资无股票持仓\n\r";
}
if(!empty($market_val)){
$subaccount_money_arr = Db::name('stock_subaccount_money')->where('stock_subaccount_id',$borrow_arr[$key]
['stock_subaccount_id'])->field('avail,freeze_amount,deposit_money,borrow_money')->find();
$subaccount_loss_warn = Db::name('stock_subaccount_risk')->where('stock_subaccount_id',$borrow_arr[$key]
['stock_subaccount_id'])->value('loss_warn');
$subaccount_loss_warn= sprintf("%.2f",($subaccount_loss_warn/100));
$loss_warn = money_convert($subaccount_money_arr['borrow_money'])+(money_convert($subaccount_money_arr['deposit_money'])*
$subaccount_loss_warn);
$now_init_amount = $market_val+money_convert($subaccount_money_arr['avail'])+money_convert($subaccount_money_arr
['freeze_amount']);
if($now_init_amount<$loss_warn && $borrow_arr[$key]['loss_warn_sms_send']==0){
$content = \think\Config::get('sms_template')['stock_loss_warn'];
$mobile[$key] = Db::name('member')->where('id', $borrow_arr[$key]['member_id'])->value('mobile');
$content = str_replace(array("#var#","#order_id#"),array($mobile[$key],$borrow_arr[$key]['order_id']), $content);
$res = sendsms_mandao($mobile[$key],$content,'user');
if($res){
Db::name('stock_borrow')->where('id',$borrow_arr[$key]['id'])->setField('loss_warn_sms_send',1);
echo "预警线提醒短信发送成功\n\r";
}
}else{
if($subaccount_money_arr && $loss_warn && $now_init_amount && $borrow_arr[$key]['loss_warn_sms_send']==1){
Db::name('stock_borrow')->where('id',$borrow_arr[$key]['id'])->setField('loss_warn_sms_send',0);
echo "该配资没有低于预警线\n\r";
}
}
}else{
echo "最新总市值获取失败\n\r";
}
}
}else{
echo "无配资记录\n\r";
}
}
这个是电脑端个股持仓的分时图截图
周K数据、买入卖出截图
用户个人中心、资金情况
class Mock extends Home
{
public function index()
{
$money=config('web_site_mock');
$this->assign('money', $money);
$this->assign('title', '模拟操盘-股票配资');
return $this->fetch();
}
}
public function free()
{
$DivideInto =explode('|', config('free_set'))[2].'%';;
$day_position = json_encode(config('day_position'));
$this->assign('free_loss', explode('|', config('free_loss'))); //预警线|平仓线(按天)
$this->assign('free_set', explode('|', config('free_set'))); //免息设置
$this->assign('DivideInto', $DivideInto);
$this->assign('day_position', $day_position);
return $this->fetch();
}
public function week()
{
$week_use_time = explode('|', config('week_use_time')); // 按周操盘期限
$max_use_time = max($week_use_time); // 最大使用时间
$min_use_time = min($week_use_time); // 最短使用时间
//单股持仓比例
$week_position = json_encode(config('week_position'));
$this->assign('week_loss', explode('|', config('week_loss'))); //预警线|平仓线(按月)
$this->assign('week_rate', config('week_rate')); // 倍率及费率
$this->assign('week_use_time', $week_use_time);
$this->assign('max_use_time', $max_use_time);
$this->assign('min_use_time', $min_use_time);
$this->assign('week_position', $week_position);
return $this->fetch();
}