|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace app\data\controller\api\business;
|
|
|
|
|
|
+use app\data\model\ShopProduction;
|
|
|
+use app\data\model\ShopProductionItem;
|
|
|
use app\data\model\ShopPurchase;
|
|
|
use app\data\model\ShopPurchaseItem;
|
|
|
use think\admin\Controller;
|
|
@@ -11,17 +13,22 @@ use hg\apidoc\annotation\Method;
|
|
|
use hg\apidoc\annotation\Param;
|
|
|
use hg\apidoc\annotation\Returned;
|
|
|
|
|
|
+/**
|
|
|
+ * 商家端发布订单
|
|
|
+ * Class Goods
|
|
|
+ * @package app\data\controller\api
|
|
|
+ */
|
|
|
class Purchase extends Controller
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
- * @Title ('采购订单发布')
|
|
|
- * @Method ('post')
|
|
|
- * @Param ('real_name',desc="联系人")
|
|
|
- * @Param ('mobile',desc="联系方式")
|
|
|
- * @Param ('post_time',desc="交货时间")
|
|
|
- * @Param ('post_address',desc="交货地址")
|
|
|
- * @Param ('item',desc="['name 商品名称','spec 规格','number 数量','standard 交货标准','price 价格']")
|
|
|
+ * @Title ("采购订单发布")
|
|
|
+ * @Method ("post")
|
|
|
+ * @Param ("real_name",desc="联系人")
|
|
|
+ * @Param ("mobile",desc="联系方式")
|
|
|
+ * @Param ("post_time",desc="交货时间")
|
|
|
+ * @Param ("post_address",desc="交货地址")
|
|
|
+ * @Param ("item",desc="['name 商品名称','spec 规格','number 数量','standard 验收标准','price 价格']")
|
|
|
* @return void
|
|
|
*/
|
|
|
public function purchase_order(){
|
|
@@ -67,11 +74,25 @@ class Purchase extends Controller
|
|
|
$this->success('发布失败');
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @Title ("生产订单发布")
|
|
|
+ * @Method ("post")
|
|
|
+ * @Param ("real_name",desc="联系人")
|
|
|
+ * @Param ("mobile",desc="联系方式")
|
|
|
+ * @Param ("standard_tech",desc="生产技术标准")
|
|
|
+ * @Param ("standard_check",desc="生产验收标准")
|
|
|
+ * @Param ("post_time",desc="交货时间")
|
|
|
+ * @Param ("post_address",desc="交货地址")
|
|
|
+ * @Param ("item",desc="['name 商品名称','spec 规格','number 数量','enclosure 附件']")
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
public function production_order(){
|
|
|
$admin_id = $this->uuid();
|
|
|
$data=$this->_vali([
|
|
|
'real_name.require'=>'联系人不能为空',
|
|
|
'mobile.require'=>'联系方式不能为空',
|
|
|
+ 'standard_tech.require'=>'生产技术标准',
|
|
|
+ 'standard_check.require'=>'生产验收标准',
|
|
|
'post_time.require'=>'交货时间不能为空',
|
|
|
'post_address.require'=>'交货单地址不能为空',
|
|
|
'item.require'=>'商品参数不能为空',
|
|
@@ -82,24 +103,25 @@ class Purchase extends Controller
|
|
|
'admin_id'=>$admin_id->id,
|
|
|
'real_name'=>$data['real_name'],
|
|
|
'mobile'=>$data['mobile'],
|
|
|
+ 'standard_tech'=>$data['standard_tech'],
|
|
|
+ 'standard_check'=>$data['standard_check'],
|
|
|
'post_time'=>$data['post_time'],
|
|
|
'post_address'=>$data['address'],
|
|
|
'create_time'=>time()
|
|
|
];
|
|
|
try {
|
|
|
- $order_id=ShopPu::mk()->insertGetId($purchase_data);
|
|
|
+ $order_id=ShopProduction::mk()->insertGetId($purchase_data);
|
|
|
foreach ($data['item'] as &$v){
|
|
|
$item_data[] = [
|
|
|
'purchase_id'=>$order_id,
|
|
|
'name'=>$v['name'],
|
|
|
'spec'=>$v['spec'],
|
|
|
'number'=>$v['number'],
|
|
|
- 'standard'=>$v['standard'],
|
|
|
- 'price'=>$v['price'],
|
|
|
+ 'enclosure'=>$v['enclosure'],
|
|
|
'status'=>1,
|
|
|
];
|
|
|
}
|
|
|
- ShopPurchaseItem::mk()->insertAll($item_data);
|
|
|
+ ShopProductionItem::mk()->insertAll($item_data);
|
|
|
// 提交事务
|
|
|
Db::commit();
|
|
|
$this->success('采购订单已发布');
|