<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Libs\wxpay\CLogFileHandler;
use App\Libs\wxpay\Log;
use App\Helpers\ReportHelper;
use App\Helpers\CommonHelper;
use App\Models\Ecg_customer;
use App\Models\Ecg_report;
use App\Models\Order;
use App\Models\Order_good;
use App\Models\Goods; class AddUserCombo extends Command
{ /**
* The name and signature of the console command.
*
* @var string
*/ protected $signature = 'add_user_combo:run {--uid=} {--spe_goo_id=}'; //传参 /**
* The console command description.
*
* @var string
*/
protected $description = 'Command description'; /**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
} /**
* php artisan add_user_combo:run --uid=88 --spe_goo_id=9
*
* Execute the console command.
*
* @return mixed
*/
public function handle()
{ //$uid = 219;
$ord_typ_id = 1;
//$spe_goo_id = 8; $uid = $this->option('uid');
$spe_goo_id = $this->option('spe_goo_id'); $info = array(
'ord_typ_id'=>$ord_typ_id,
'out_trade_no'=>CommonHelper::get_order_sn(),
'use_id'=>$uid,
'ord_sta_id'=>1,
'ord_display'=>0,
'ord_pay_sta_id'=>1,
'ord_pay_typ_id'=>1,
'ord_cre_date'=>date('Y-m-d H:i:s', time())
);
$obj = Order::create($info); $ord_id = $obj->id;
$info = array(
'ord_id'=>$ord_id,
'goo_id'=>$spe_goo_id,
'goo_quantity'=>1 );
$obj_order_good = Order_good::create($info); $add_quantity = 0;
$list = Goods::where(['goo_id'=>$spe_goo_id])->get()->toArray();
foreach($list as $v) {
$add_quantity = $v['goo_quantity'];
} var_dump('Order insert id:'.$obj->id);
var_dump('Order_good insert id:'.$obj_order_good->id); if($add_quantity) {
$ret = Ecg_customer::where(['ecg_cus_id'=>$uid])->increment('ecg_cus_ava_times', $add_quantity);
if($ret) {
echo 'increment add_quantity '.$add_quantity.' success!';
} else {
echo 'increment add_quantity '.$add_quantity.' fail!';
}
} else {
echo 'the goo_id :'.$spe_goo_id.' of quantity is 0';
} }
}

laravel console handle 传参方法的更多相关文章

  1. 学习chrome 插件 DHC ,http请求传参方法

    DHC的简介 DHC是一款可以帮助用户使用chrome插件模拟HTTP客户端发送测试数据到服务器的谷歌浏览器插件,在chrome中安装了DHC插件以后,就可在服务器端代码初步完成的时候,使用DHC进行 ...

  2. jquery-uploadify传参方法

    jquery-uploadify传参方法$(document).ready(function () { $("#uploadify").uploadify({ 'uploader' ...

  3. js方法之间的调用之——传参方法

    在最近项目需求中发现,完成一些功能的时候总是要调很多结构类似的方法,写起来很繁琐,所以就想写一个“万能”方法,是的代码更简洁.即:把一个方法作为参数传给这个“万能”方法,让它去执行你给定的方法,就类似 ...

  4. 定时器setTimeout()的传参方法

    更具体的代码:http://www.cnblogs.com/3body/p/5416830.html // 由于setTimeout()的延迟执行特性,所以在执行的函数中直接使用外部函数的变量是无法获 ...

  5. AngularJS中页面传参方法

    1.基于ui-router的页面跳转传参 (1) 用ui-router定义路由,比如有两个页面,一个页面(producers.html)放置了多个producers,点击其中一个目标,页面跳转到对应的 ...

  6. TKinter当Label绑定bind事件时传参方法

    记录下tkinter的 当在label绑定bind事件时,遇到需要传参时的解决方法(因为有event存在 所以不能直接传参) https://www.cnblogs.com/liyuanhong/ar ...

  7. 不用Ajax时的传参方法

    不用Ajax时的怎么传参 创建一个form表单 function test(){ var params = { "参数名": "参数值" }; postExce ...

  8. unittest改写传参方法

    Python主要讲究简洁简单使用,所以它不像junit一样支持参数化测试,需要改装一下也可以传参.直接上代码实例 import unittest class ParametrizedTestCase( ...

  9. tp5闭包子查询传参方法

    在channel表中查询status,channel_id,channel_name,account_level这些字段,且这些字段的channel_id不在adv_id为$id的表adv_chann ...

随机推荐

  1. BZOJ3514 GERALD07加强版

    GERALD07 Description N个点M条边的无向图,询问保留图中编号在[l,r]的边的时候图中的联通块个数. Input 第一行四个整数N.M.K.type,代表点数.边数.询问数以及询问 ...

  2. NOSQL数据库简介

    什么是NoSQL?泛指非关系型的数据库不支持SQL语法存储结构跟传统关系型数据库中的那种关系表完全不同,nosql中存储的数据都是Key-Value(即键值对关系)形式NoSQL的世界中没有一种通用的 ...

  3. linux 忘记root密码怎么处理。

    这个是不少人纠结的地方.一台服务器,太久没使用,然后又没有一个文件txt,excel记录那些密码相关的东西.所以导致很多信息忘记了. 参考文章:https://blog.csdn.net/cranky ...

  4. Jquery tabs

    官网 http://api.jqueryui.com/tabs/ 必须通过了后台验证tab1的信息后才允许进入tab2 var passed=false;          $("#tabs ...

  5. exam8.29

    咕了好几篇后... 我终于开始重新写了 T1: 不会,没思路,暴搜还可能会(一开始我以为暴搜时间复杂度为$\Theta (mn ^ k)$) 于是码出了暴搜... 跑一遍$(4,4,5)$,然后... ...

  6. 【原】Python基础-序列

    1 序列 在Python中,最基本的数据结构是序列,序列中每个元素被分配一个编号,也称为索引.第一个索引为0,第二个则是1,以此类推.序列中最后一个元素被标为-1,倒数第二个元素被标为-2,以此类推. ...

  7. Alpha项目冲刺! Day5-产出

    各个成员今日完成的任务 林恩:任务分工,博客撰写,了解安卓环境搭建 杨长元:安卓本地数据库基本建立 李震:改了图标和背景 胡彤:完善服务端 寇永明:研究测试代码 王浩:研究测试代码 李杰:研究测试代码 ...

  8. Webpack中的sourcemap以及如何在生产和开发环境中合理的设置

    一 . 从Sourcemap和Data URL说起 (1)什么是Sourcemap? 我们在打包中,将开发环境中源代码经过压缩,去空格,babel编译转化,最终可以得到适用于生产环境的项目代码,这样处 ...

  9. 蜜汁头文件&&slow slow read

    slow slow read 板子 inline int read() { ; char last=' ',ch=getchar(); ') last=ch,ch=getchar(); +ch-',c ...

  10. github又提交不了代码了..... X_X

    如下: 我们使用git提交代码过程中,突然就登录不上了 原因是 用户名被更改了:git@gitlab.0easy.com 是你的用户名 造成的原因是: 我们clone代码过程中选择了SSH的地址 解决 ...