Ver código fonte

更新是否显示拼音问题

王大坤 1 ano atrás
pai
commit
94c890474f

+ 1 - 1
.idea/php.xml

xqd
@@ -10,7 +10,7 @@
     <option name="highlightLevel" value="WARNING" />
     <option name="transferred" value="true" />
   </component>
-  <component name="PhpProjectSharedConfiguration" php_language_level="7.4">
+  <component name="PhpProjectSharedConfiguration" php_language_level="7.3">
     <option name="suggestChangeDefaultLanguageLevel" value="false" />
   </component>
   <component name="PhpStanOptionsConfiguration">

+ 15 - 8
server/app/Http/Controllers/V1/Ai/AiController.php

xqd xqd xqd xqd xqd
@@ -48,7 +48,7 @@ class AiController extends Controller
                     'age'     => $request->post('age', ''),
                     'star'    => $request->post('star', ''),
                     'level'   => $request->post('level', ''),
-                    'is_piny'   => $request->post('is_piny', 1),
+//                    'is_piny'   => $request->post('is_piny', 1),
                 ]);
                 if (!$role) {
                     return Response::fail('提交失败,请稍后再试!');
@@ -62,6 +62,7 @@ class AiController extends Controller
                 'surplus_diamond' => Auth::$user->diamond - $plot,
                 'nickname'        => 'AI绘本生成',
                 'plot'            => $plot,
+                'is_piny'   => $request->post('pinYin', 1),
             ]);
             if (!$task) {
                 return Response::fail('任务提交失败');
@@ -328,7 +329,7 @@ class AiController extends Controller
                 $file_name = md5(time()) . '.png';
             }
             $path  = public_path() . '/images/' . $file_name;
-            $shell = 'wkhtmltoimage https://t18.9026.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
+            $shell = 'wkhtmltoimage https://hb.swdz.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
             exec($shell, $result, $status);
             if ($status) {
                 $this->exit_out('生成图片失败', ['生成图片失败' => [$shell, $result, $status]]);
@@ -369,7 +370,7 @@ class AiController extends Controller
                 $file_name = md5(time()) . '.pdf';
             }
             $path  = public_path() . '/pdf/' . $file_name;
-            $shell = 'wkhtmltopdf https://t18.9026.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
+            $shell = 'wkhtmltopdf https://hb.swdz.com/api/ai/Pinyin?id=' . $task->id . ' ' . $path;
             exec($shell, $result, $status);
             if ($status) {
                 $this->exit_out('生成PDF失败', ['生成PDF失败' => [$shell, $result, $status]]);
@@ -551,18 +552,24 @@ class AiController extends Controller
                 $string = $string . $img;
             }
             if (in_array($key + 1, $arr)) {
-//                $string = $string . "<span><sup>{$value}</sup>{$splitCharacters[$key]}</span><br style='clear: both'><br style='clear: both'>";
-                $string = $string . "<span>{$splitCharacters[$key]}</span><br style='clear: both'><br style='clear: both'>";
+                if ($result->is_piny){
+                    $string = $string . "<span><sup>{$value}</sup>{$splitCharacters[$key]}</span><br style='clear: both'><br style='clear: both'>";
+                }else{
+                    $string = $string . "<span>{$splitCharacters[$key]}</span><br style='clear: both'><br style='clear: both'>";
+                }
+
             } else {
                 $style = '';
                 // if (in_array($key, $arr) || 0 == $key) {
                 //     $style = 'style="margin-left: 5rem"';
                 // }
-//                $string = $string . '<span ' . $style . "><sup>{$value}</sup>{$splitCharacters[$key]}</span>";
-                $string = $string . '<span ' . $style . ">{$splitCharacters[$key]}</span>";
+                if ($result->is_piny){
+                    $string = $string . '<span ' . $style . "><sup>{$value}</sup>{$splitCharacters[$key]}</span>";
+                }else{
+                    $string = $string . '<span ' . $style . ">{$splitCharacters[$key]}</span>";
+                }
             }
         }
-
         return $string;
     }
 }

+ 1 - 1
server/app/Models/TaskList.php

xqd
@@ -8,7 +8,7 @@ class TaskList extends Model
 {
     protected $table    = 'task_list';
     protected $fillable = ['user_id', 'title', 'role_id', 'content', 'created_at', 'updated_at', 'state', 'image', 'init_content', 'keyword', 'sd_image',
-        'desc', 'sd_id', 'surplus_diamond', 'nickname', 'plot', 'is_handpick', 'sort', 'pinyin_content', 'pdf_path', 'image_path'];
+        'desc', 'sd_id', 'surplus_diamond', 'nickname', 'plot', 'is_handpick', 'sort', 'pinyin_content', 'pdf_path', 'image_path','is_piny'];
     public static $state = [
         0 => '已提交',
         1 => '生成中',

+ 2 - 2
server/app/libs/wechat/pay/Wechat.php

xqd xqd
@@ -49,7 +49,7 @@ class Wechat
             'cert_path' => __DIR__ . '/ssl/apiclient_cert.pem', // XXX: 绝对路径!!!!
             'key_path'  => __DIR__ . '/ssl/apiclient_key.pem',      // XXX: 绝对路径!!!!
 
-            'notify_url' => 'https://t18.9026.com/api/wechat/pay/aiCallback',     // 你也可以在下单时单独设置来想覆盖它
+            'notify_url' => 'https://hb.swdz.com/api/wechat/pay/aiCallback',     // 你也可以在下单时单独设置来想覆盖它
         ];
 
         $app = Factory::payment($config);
@@ -98,7 +98,7 @@ class Wechat
             'out_trade_no'     => $order->order,
             'total_fee'        => $order->amount * 10000,
             'spbill_create_ip' => '47.93.12.114', // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
-            'notify_url'       => 'https://t18.9026.com/api/wechat/pay/aiCallback', // 支付结果通知网址,如果不设置则会使用配置里的默认地址
+            'notify_url'       => 'https://hb.swdz.com/api/wechat/pay/aiCallback', // 支付结果通知网址,如果不设置则会使用配置里的默认地址
             'trade_type'       => 'JSAPI', // 请对应换成你的支付方式对应的值类型
             'openid'           => $user->open_id,
         ]);