12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\api\controller\water;
- use app\admin\model\water\WaterMaterialScience;
- use app\Request;
- use crmeb\services\GroupDataService;
- use crmeb\services\QrcodeService;
- use crmeb\services\UtilService;
- /**
- * 秒杀产品类
- * Class StoreSeckillController
- * @package app\api\controller\activity
- */
- class WaterQueryController
- {
- public function calculation(Request $request)
- {
- $data = UtilService::postMore([
- ['long', ''],// 长
- ['wide', ''],// 宽
- ['high', ''],// 高
- ['is_warm', ''], // 是否保温
- ['is_channel', ''], // 是否需要槽钢
- ['is_human_ladder', ''] ,// 是否需要人梯
- ['is_gc', ''] ,// 公差
- ['floor', ''], // 底板厚度
- ['side_plate', ''], // 侧板厚度
- ['roof', ''], // 顶板厚度
- ['column', ''], // 立柱厚度
- ['lacing', ''], // 拉筋厚度
- ['fula', ''], // 辅拉
- ]);
- //顶板
- if ($data['is_gc'] > 0){
- $where[] = ['is_gc', '=' ,1];
- }else{
- $where[] = ['is_gc', '=' ,0];
- }
- $roof = WaterMaterialScience::where('id', $data['roof'])->find();
- $roofs = WaterMaterialScience::where('type', 1)->where('th_id', $roof['th_id'])->where($where)->column('long,wide', 'id');//符合厚度的顶板
- $area = $data['long'] * $data['wide'];// 面积
- $roof_number = ($data['long']/1) * intval(($data['wide']/1)); // 顶板使用数量1*1
- halt($roof_number);
- }
- /**
- * 材料列表
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function list()
- {
- $data = UtilService::getMore(['is_gc']);
- $list = [];
- if ($data['is_gc'] > 0){
- $where[] = ['is_gc', '=' ,1];
- }else{
- $where[] = ['is_gc', '=' ,0];
- }
- $list['warm'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 7)->where($where)->select(); // 保温
- $list['channel'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 8)->where($where)->select(); // 槽钢
- $list['roof'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 1)->where($where)->select();// 顶板
- $list['side_plate'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 2)->where($where)->select();// 侧板
- $list['lacing'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 3)->where($where)->select();// 拉筋
- $list['floor'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 4)->where($where)->select(); // 底板
- $list['column'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 5)->where($where)->select(); // 立柱
- $list['fula'] = WaterMaterialScience::field('id,name,unit_price,company')->where('type', 6)->where($where)->select(); // 辅拉
- return app('json')->success($list);
- }
- }
|