display and update slogan

This commit is contained in:
niuhuan 2022-02-25 00:08:18 +08:00
parent 395ecad337
commit 1917032d8d
10 changed files with 155 additions and 47 deletions

View File

@ -8,11 +8,13 @@ require (
github.com/go-flutter-desktop/plugins/url_launcher v0.1.2
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265
github.com/miguelpruivo/flutter_file_picker/go v0.0.0-20210622152105-9f0a811028a0
github.com/niuhuan/pica-go v0.0.0-20211115032844-c44c612e1641
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/niuhuan/pica-go v0.0.0-20220223122613-0d7d95a9c728
github.com/pkg/errors v0.9.1
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
golang.org/x/mobile v0.0.0-20210924032853-1c027f395ef7 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/mobile v0.0.0-20220224134551-8a0a1e50732f // indirect
golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7 // indirect
golang.org/x/tools v0.1.9 // indirect
gorm.io/driver/sqlite v1.1.4
gorm.io/gorm v1.21.12
)

View File

@ -21,6 +21,7 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265 h1:BcbKYUZo/TKPsiSh7LymK3p+TNAJJW3OfGO/21sBbiA=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201108214237-06ea97f0c265/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190915194858-d3ddacdb130f h1:TyqzGm2z1h3AGhjOoRYyeLcW4WlW81MDQkWa+rx/000=
github.com/gopherjs/gopherjs v0.0.0-20190915194858-d3ddacdb130f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
@ -29,26 +30,22 @@ github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkr
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ=
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/miguelpruivo/flutter_file_picker/go v0.0.0-20210622152105-9f0a811028a0 h1:hXl9AMW20Php3xWlWZr2Acw50tqeblLgtLfLoRCACmA=
github.com/miguelpruivo/flutter_file_picker/go v0.0.0-20210622152105-9f0a811028a0/go.mod h1:csuW+TFyYKtiUwNvcvhcpyX4quPI7Pvv0SUogdqCW4I=
github.com/niuhuan/pica-go v0.0.0-20211008032829-544a58c56bee h1:SewxTGOkoJ3JUmLLQ1RXUcqLdifT5502QZQl09eCGL8=
github.com/niuhuan/pica-go v0.0.0-20211008032829-544a58c56bee/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211102035530-65029bd4ee97 h1:wlsmZVsLrZ/dB1KzyRl3TR6vRa6eefVE/16LnSHrQs8=
github.com/niuhuan/pica-go v0.0.0-20211102035530-65029bd4ee97/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211105060849-4f6ae99a942e h1:NR/RCPlbx7cMjk7p8GqfkhOqWTH6vyfgYq7Vubjn9mY=
github.com/niuhuan/pica-go v0.0.0-20211105060849-4f6ae99a942e/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211109012708-2cef9976dbaa h1:PnIE6Ltz/dy9K1jZCGfTvPDHGitSwXVvQfzwgVIJSWE=
github.com/niuhuan/pica-go v0.0.0-20211109012708-2cef9976dbaa/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211109043215-974462cb2b0d h1:jwZdWp1PkEbWAi/w3cI+4kBvIyxHtZgVmFFOu7XnABw=
github.com/niuhuan/pica-go v0.0.0-20211109043215-974462cb2b0d/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211109050119-cf22461c638f h1:SQ6vAF7nyIDjhUj/SsEHRlxae4XLtygSuxWrJJazN1g=
github.com/niuhuan/pica-go v0.0.0-20211109050119-cf22461c638f/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/niuhuan/pica-go v0.0.0-20211115032844-c44c612e1641 h1:5k9rtY8Ri+wphRQ4hi/EiPwXHaIs7ZJzagRtMFXajb4=
github.com/niuhuan/pica-go v0.0.0-20211115032844-c44c612e1641/go.mod h1:fx2m+OgMeEZf6/TrfblV9i85SjPsOGbnjIL2gohxP4M=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niuhuan/pica-go v0.0.0-20220223122613-0d7d95a9c728 h1:zcO9WFgYbQ3g9U1nbJ6PCelzGB/BaPsCW9jwNry2JXM=
github.com/niuhuan/pica-go v0.0.0-20220223122613-0d7d95a9c728/go.mod h1:r76zBgH9AYkv0ptyEVoPUIdt33sT0Ts7xgcg742OZtw=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -59,10 +56,12 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@ -71,40 +70,50 @@ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMx
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20210924032853-1c027f395ef7 h1:CyFUjc175y/mbMjxe+WdqI72jguLyjQChKCDe9mfTvg=
golang.org/x/mobile v0.0.0-20210924032853-1c027f395ef7/go.mod h1:c4YKU3ZylDmvbw+H/PSvm42vhdWbuxCzbonauEAP9B8=
golang.org/x/mobile v0.0.0-20220224134551-8a0a1e50732f h1:G/wQ/Mbs60nXhRM80J4DOzy7FEIZjNprzOneArSgOl0=
golang.org/x/mobile v0.0.0-20220224134551-8a0a1e50732f/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200802091954-4b90ce9b60b3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7 h1:BXxu8t6QN0G1uff4bzZzSkpsax8+ALqTGUtz08QrV00=
golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098 h1:YuekqPskqwCCPM79F1X5Dhv4ezTCj+Ki1oNwiafxkA0=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=

View File

@ -3,13 +3,14 @@
package pikapika
import (
"encoding/base64"
"encoding/json"
"fmt"
source "github.com/niuhuan/pica-go"
"net"
"net/http"
"net/url"
comic_center2 "pikapika/pikapika/database/comic_center"
"pikapika/pikapika/database/comic_center"
"pikapika/pikapika/database/network_cache"
"pikapika/pikapika/database/properties"
"regexp"
@ -200,7 +201,7 @@ func comicInfo(comicId string) (string, error) {
network_cache.SaveCache(key, cache)
}
// 标记历史记录
view := comic_center2.ComicView{}
view := comic_center.ComicView{}
view.ID = comicId
view.CreatedAt = comic.CreatedAt
view.UpdatedAt = comic.UpdatedAt
@ -224,7 +225,7 @@ func comicInfo(comicId string) (string, error) {
view.IsFavourite = comic.IsFavourite
view.IsLiked = comic.IsLiked
view.CommentsCount = int32(comic.CommentsCount)
err = comic_center2.ViewComicUpdateInfo(&view)
err = comic_center.ViewComicUpdateInfo(&view)
if err != nil {
return "", err
}
@ -283,7 +284,7 @@ func switchLike(comicId string) (string, error) {
return "", err
}
// 更新viewLog里面的favour
comic_center2.ViewComicUpdateLike(comicId, strings.HasPrefix(*point, "un"))
comic_center.ViewComicUpdateLike(comicId, strings.HasPrefix(*point, "un"))
// 删除缓存
ComicInfoCleanCache(comicId)
return *point, nil
@ -295,7 +296,7 @@ func switchFavourite(comicId string) (string, error) {
return "", err
}
// 更新viewLog里面的favour
comic_center2.ViewComicUpdateFavourite(comicId, strings.HasPrefix(*point, "un"))
comic_center.ViewComicUpdateFavourite(comicId, strings.HasPrefix(*point, "un"))
// 删除缓存
ComicInfoCleanCache(comicId)
return *point, nil
@ -532,3 +533,27 @@ func switchLikeGameComment(params string) (string, error) {
network_cache.RemoveCaches(fmt.Sprintf("GAME_COMMENTS$%s$%%", paramsStruct.GameId))
return *rsp, nil
}
func updatePassword(params string) (string, error) {
var paramsStruct struct {
OldPassword string `json:"oldPassword"`
NewPassword string `json:"newPassword"`
}
err := json.Unmarshal([]byte(params), &paramsStruct)
if err != nil {
return "", err
}
return "", client.UpdatePassword(paramsStruct.OldPassword, paramsStruct.NewPassword)
}
func updateSlogan(slogan string) (string, error) {
return "", client.UpdateSlogan(slogan)
}
func updateAvatar(avatarBase64 string) (string, error) {
buff, err := base64.StdEncoding.DecodeString(avatarBase64)
if err != nil {
return "", err
}
return "", client.UpdateAvatar(buff)
}

View File

@ -724,8 +724,12 @@ func FlatInvoke(method string, params string) (string, error) {
return strconv.Itoa(loadDownloadThreadCount()), nil
case "switchLikeComment":
return switchLikeComment(params)
case "defaultHttpClientGet":
return defaultHttpClientGet(params)
case "updatePassword":
return updatePassword(params)
case "updateSlogan":
return updateSlogan(params)
case "updateAvatar":
return updateAvatar(params)
}
return "", errors.New("method not found : " + method)
}

View File

@ -148,7 +148,11 @@ Future<T?> chooseMapDialog<T>(
var _controller = TextEditingController.fromValue(TextEditingValue(text: ''));
Future<String?> displayTextInputDialog(BuildContext context,
{String? title, String src = "", String? hint, String? desc, bool isPasswd = false}) {
{String? title,
String src = "",
String? hint,
String? desc,
bool isPasswd = false}) {
_controller.text = src;
return showDialog(
context: context,
@ -238,8 +242,12 @@ final TextEditingController _textEditController =
TextEditingController(text: '');
Future<String?> inputString(BuildContext context, String title,
{String hint = ""}) async {
_textEditController.clear();
{String hint = "", String? defaultValue}) async {
if (defaultValue != null) {
_textEditController.text = defaultValue;
} else {
_textEditController.clear();
}
return showDialog(
context: context,
builder: (context) {

View File

@ -22,6 +22,7 @@ class BasicUser {
late int level;
late List<String> characters;
late RemoteImageInfo avatar;
late String? slogan;
BasicUser.fromJson(Map<String, dynamic> json) {
this.id = json["_id"];
@ -36,6 +37,7 @@ class BasicUser {
: List.of(json["characters"]).map((e) => "$e").toList();
this.avatar =
RemoteImageInfo.fromJson(Map<String, dynamic>.of(json["avatar"]));
this.slogan = json["slogan"];
}
}
@ -160,12 +162,10 @@ class ComicInfo extends ComicSimple {
///
class Creator extends BasicUser {
late String slogan;
late String role;
late String character;
Creator.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
this.slogan = json["slogan"];
this.role = json["role"];
this.character = json["character"];
}

View File

@ -3,7 +3,6 @@ import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:pikapika/basic/Entities.dart';
import 'package:pikapika/basic/config/Quality.dart';
/// 使MethodChannel与平台通信
@ -688,4 +687,9 @@ class Method {
Future<String> defaultHttpClientGet(String url) async {
return await _flatInvoke("defaultHttpClientGet", url);
}
///
Future updateSlogan(String input) async {
return await _flatInvoke("updateSlogan", input);
}
}

View File

@ -1,7 +1,6 @@
import 'dart:async' show Future;
import 'dart:convert';
import 'package:event/event.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:pikapika/basic/Common.dart';

View File

@ -3,10 +3,12 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:pikapika/basic/Common.dart';
import 'package:pikapika/basic/Entities.dart';
import 'package:pikapika/screens/components/ItemBuilder.dart';
import 'package:pikapika/basic/Method.dart';
import 'package:pikapika/screens/components/Avatar.dart';
import 'package:pikapika/screens/components/Images.dart';
import 'package:pikapika/basic/Method.dart';
import 'package:pikapika/screens/components/ItemBuilder.dart';
const double _cardHeight = 180;
//
class UserProfileCard extends StatefulWidget {
@ -40,15 +42,39 @@ class _UserProfileCardState extends State<UserProfileCard> {
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
var nameStyle = TextStyle(fontWeight: FontWeight.bold);
var nameStyle = TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
);
var nameStrutStyle = StrutStyle(
fontSize: 14,
forceStrutHeight: true,
fontWeight: FontWeight.bold,
);
var levelStyle = TextStyle(
fontSize: 12, color: theme.colorScheme.secondary.withOpacity(.8));
fontSize: 12,
color: theme.colorScheme.secondary.withOpacity(.9),
fontWeight: FontWeight.bold,
);
var levelStrutStyle = StrutStyle(
fontSize: 12,
forceStrutHeight: true,
fontWeight: FontWeight.bold,
);
var sloganStyle = TextStyle(
fontSize: 10,
color: theme.textTheme.bodyText1?.color?.withOpacity(.5),
);
var sloganStrutStyle = StrutStyle(
fontSize: 10,
forceStrutHeight: true,
);
return ItemBuilder(
future: _future,
onRefresh: () async {
setState(() => _future = method.userProfile());
},
height: 150,
height: _cardHeight,
successBuilder:
(BuildContext context, AsyncSnapshot<UserProfile> snapshot) {
UserProfile profile = snapshot.data!;
@ -66,7 +92,7 @@ class _UserProfileCardState extends State<UserProfileCard> {
path: profile.avatar.path,
fileServer: profile.avatar.fileServer,
width: constraints.maxWidth,
height: 150,
height: _cardHeight,
);
},
),
@ -82,19 +108,44 @@ class _UserProfileCardState extends State<UserProfileCard> {
),
),
Container(
height: 150,
height: _cardHeight,
child: Column(
children: [
Expanded(child: Container()),
Avatar(profile.avatar),
Container(width: 18),
Avatar(profile.avatar, size: 65),
Container(height: 5),
Text(
profile.name,
style: nameStyle,
strutStyle: nameStrutStyle,
),
Text(
"Lv. ${profile.level} (${profile.title})",
style: levelStyle,
strutStyle: levelStrutStyle,
),
Container(height: 8),
GestureDetector(
onTap: () async {
var input = await inputString(
context,
"更新签名",
defaultValue: profile.slogan ?? "",
);
if (input != null) {
await method.updateSlogan(input);
setState(() {
_future = _load();
});
}
},
child: Text(
profile.slogan == null || profile.slogan!.isEmpty
? "这个人很懒, 什么也没留下"
: profile.slogan!,
style: sloganStyle,
strutStyle: sloganStrutStyle,
),
),
Expanded(child: Container()),
],

View File

@ -1 +1,7 @@
# 编译所有架构的依赖
cd "$( cd "$( dirname "$0" )" && pwd )/.."
cd go/mobile
gomobile bind -target=android/arm,android/arm64,android/386,android/amd64 -o lib/Mobile.aar ./