<?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. 洛谷P1991 无线通讯网【最小生成树】

    题目:https://www.luogu.org/problemnew/show/P1991 题意:有p个点的坐标,可以有s个点使得这s个点之间可以无限制通信. 要使所有点之间两两有通信的路径(可以是 ...

  2. 自定义的JSP标签

    JSP标签 JSP标准标签库(JSTL)是一个JSP标签集合,它封装了JSP应用的通用核心功能. JSTL支持通用的.结构化的任务,比如迭代,条件判断,XML文档操作,国际化标签,SQL标签. 除了这 ...

  3. Laravel Model updating&updated 事件使用注意事项

    1 触发条件 1.1 updating 1.1.1 如果字段无变化,不会触发此事件. 1.1.2 除非更改至少一个字段的值 2 事件逻辑不会覆盖 2.1 Trait 中定义事件如下 /** * The ...

  4. oracle的jdbc.properties文件配置

    ----------Oracle #do Oracle JDBC jdbc.driverClassName=oracle.jdbc.driver.OracleDriverjdbc.url=jdbc:o ...

  5. exam8.3

    rank25凉凉好吧......T1:...        一开始完全**        手玩给的那张图(不放图,我太饿把图吃了)        发现对于任一个节点,减去上一个比他小的斐波那契数就是父 ...

  6. [USACO08FEB]酒店Hotel 线段树

    [USACO08FEB]酒店Hotel 线段树 题面 其实就是区间多维护一个lmax,rmax(表示从左开始有连续lmax个空房,一直有连续rmax个空房到最右边),合并时讨论一下即可. void p ...

  7. 1069 The Black Hole of Numbers(20 分)

    For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in ...

  8. 一个类中域(field)的首字母不要大写

    首先这种写法不规范, 其次,至少在AJAX交互的情况下, 如果首字母大写,会无法与前端相同名称的JSON属性相绑定. 如 data:{'Name':'2017-10-19'} public NameI ...

  9. 10月清北学堂培训 Day 7

    今天是黄致焕老师的讲授~ 历年真题选讲 NOIP 2012 开车旅行 小 A 和小 B 决定外出旅行,他们将想去的城市从 1 到 n 编号,且编号较小的城市在编号较大的城市的西边.记城市 i 的海拔高 ...

  10. vue+elementui 开发的网站IE浏览器加载白屏(不兼容)解决办法

    1.需要检查一下 export default { name: 'aa',-------vue的name是不可以重复的-----这个是决定性原因 data() { return {} } 2.变量声明 ...