$type, 'root_id' => request()->employee->root_id])->inc('use_number'); return json(['code' => self::success, 'msg' => '浏览量增加']); } /* * 装修报价算一算 */ public function quotationform() { $param = $this->request->only(['name', 'mobile', 'community', 'area', 'room', 'office', 'wei', 'style', 'type']); $data = [ 'name' => $param['name'], 'mobile' => $param['mobile'], 'community' => $param['community'], 'area' => $param['area'], 'bedroom' => $param['room'] . '/' . $param['office'] . '/' . $param['wei'], 'style' => $param['style'], 'type' => $param['type'], ]; // 足迹 $token = $this->request->token; if (!empty($token['uid']) && !$token['isEmployee']) { event(new FootPrints($token['uid'], $token['share_employee'] ?? 0, $token['share_org'] ?? 0, $data, 'priceCalculation')); } return json(['code' => self::success, 'msg' => '报名成功,等待联系']); } /* * 风格图片测试结果 */ public function styleTestResult() { $result = $this->request->param('result'); //逗号分隔的喜欢风格类型 // 风格结果 $style = [ 1 => ['style' => '现代简约', 'msg' => '线条简单,设计独特', 'function' => '色彩明亮洁净', 'city' => '郑州、广州', 'style_elements' => '黑白灰为主色调'], 2 => ['style' => '新中式', 'msg' => '文化涵养', 'function' => '文化氛围', 'city' => '杭州、北京', 'style_elements' => '黑白灰基础上加与红黄蓝绿'], 3 => ['style' => '北欧', 'msg' => '优雅自然风情', 'function' => '简约大方', 'city' => '上海、江苏', 'style_elements' => '偏浅色、以纯色为主'], 4 => ['style' => '简欧', 'msg' => '华美厚重', 'function' => '典雅、自然、高贵', 'city' => '武汉、南京', 'style_elements' => '白色、淡色为主,风格统一'], 5 => ['style' => '地中海', 'msg' => '人文风情', 'function' => '素雅浪漫', 'city' => '青岛、海南', 'style_elements' => '蓝与白、土黄与红褐'], 6 => ['style' => '美式', 'msg' => '自在、随意', 'function' => '外观简洁大方', 'city' => '上海、北京', 'style_elements' => '暗中色、土黄色,自然色彩'], 7 => ['style' => '轻奢', 'msg' => '高级感', 'function' => '高级感', 'city' => '深圳、苏州', 'style_elements' => '金属、大理石、蓝色配色等元素来烘托空间'], 8 => ['style' => '田园', 'msg' => '回归自然', 'function' => '自然、舒适、温婉内敛', 'city' => '苏州、济南', 'style_elements' => '田园气息、追求朴实亲切感'], 9 => ['style' => '混搭', 'msg' => '简约时尚', 'function' => '追求自主', 'city' => '成都、西安', 'style_elements' => '色彩随意自主、极富个性'] ]; // 风格结果计算方式 $arr = explode(',', $result); //计算结果 if (empty($result)) { //全部不喜欢,为混搭 $style_status = 9; } elseif (mb_strlen($result) == 1) { //喜欢一张,则喜欢这一种风格为测试结果 $style_status = $result; } elseif (count($arr) == count(array_unique($arr))) { //喜欢的风格没有重复,则为混搭 $style_status = 9; } else { $res = array_unique(array_diff_assoc($arr, array_unique($arr))); if (count($res) == 1) { //喜欢的风格出现一种重复则测试结果为这种风格 $re = implode($res); $style_status = $re; } else { //喜欢风格出现两种以上重复,则为混搭 $style_status = 9; } } $data = ['style' => $style[$style_status]['style']]; // 足迹 $token = $this->request->token; if (!empty($token['uid']) && !$token['isEmployee']) { event(new FootPrints($token['uid'], $token['share_employee'] ?? 0, $token['share_org'] ?? 0, $data, 'styleTest')); } $count = ToolSettings::where(['tool_type'=> 'styleTest','root_id' => request()->employee->root_id])->value('use_number'); return json([ 'code' => self::success, 'style' => $style[$style_status]['style'], 'msg' => $style[$style_status]['msg'], 'function' => $style[$style_status]['function'], 'city' => $style[$style_status]['city'], 'style_elements' => $style[$style_status]['style_elements'], 'testNum' => $count ]); } }